Commit Graph

12556 Commits

Author SHA1 Message Date
Fabien Potencier 1f1392dc8b [HttpKernel] simplified and enhanced code managing the hinclude strategy 2013-01-10 09:21:31 +01:00
Fabien Potencier 403bb060ce [HttpKernel] added missing phpdoc and tweaked existing ones 2013-01-10 09:21:31 +01:00
Fabien Potencier 892f00ffee [HttpKernel] added a URL signer mechanism for hincludes 2013-01-10 09:21:31 +01:00
Fabien Potencier a0c49c3a94 [TwigBridge] added a render_* function to ease usage of custom rendering strategies
Here is the code you need to write when using the regular render
function for an ESI strategy:

    {{ render(path('path'), { strategy: 'esi' })
}}

And the same with the new render_* function:

    {{ render_esi(path('path')) }}
2013-01-10 09:21:30 +01:00
Fabien Potencier 9aaceb19ee moved the logic from HttpKernel in FrameworkBundle to the HttpKernel component 2013-01-10 09:21:30 +01:00
Fabien Potencier b981a6fa60 merged branch bschussek/bugfix (PR #6630)
This PR was merged into the master branch.

Commits
-------

c1aff96 [Form] Fixed regression introduced when merging 2.1 into master

Discussion
----------

[Form] Fixed regression introduced when merging 2.1 into master

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
2013-01-09 10:47:19 +01:00
Bernhard Schussek c1aff96eb0 [Form] Fixed regression introduced when merging 2.1 into master 2013-01-09 10:35:45 +01:00
Fabien Potencier 3a4869dd14 merged branch Tobion/relative-path (PR #3958)
This PR was merged into the master branch.

Commits
-------

6703fb5 added changelog entries
1997e2e fix phpdoc of UrlGeneratorInterface that missed some exceptions and improve language of exception message
f0415ed [Routing] made reference type fully BC and improved phpdoc considerably
7db07d9 [Routing] added tests for generating relative paths and network paths
75f59eb [Routing] add support for path-relative and scheme-relative URL generation

Discussion
----------

[2.2] [Routing] add support for path-relative URL generation

Tests pass: yes
Feature addition: yes
BC break: <del>tiny (see below)</del> NO
deprecations: NO

At the moment the Routing component only supports absolute and domain-relative URLs, e.g.
`http://example.org/user-slug/article-slug/comments` and
`/user-slug/article-slug/comments`.

But there are two link types missing: schema-relative URLs and path-relative URLs.
schema-relative: e.g. `//example.org/user-slug/article-slug/comments`
path-relative: e.g. `comments`.

Both of them would now be possible with this PR. I think it closes a huge gap in the Routing component.
Use cases are pretty common. Schema-relative URLs are for example used when you want to include assets (scripts, images etc) in a secured website with HTTPS. Path-relative URLs are the only option when you want to generate static files (e.g. documentation) that can be downloaded as an HTML archive. Such use-cases are currently not possible with symfony.

The calculation of the relative path based on the request path and target path is hightly unit tested. So it is really equivalent. I found several implemenations on the internet but none of them worked in all cases. Mine is pretty short and works.

I also added an optional parameter to the twig `path` function, so this feature can also be used in twig templates.

Ref: This implements path-relative URLs as suggested in #3908.

<del>[BC BREAK] The signature of UrlGeneratorInterface::generate changed to support scheme-relative and path-relative URLs. The core UrlGenerator is BC and does not break anything, but users who implemented their own UrlGenerator need to be aware of this change. See UrlGenerator::convertReferenceType.</del>

---------------------------------------------------------------------------

by jalliot at 2012-04-16T09:56:56Z

@Tobion For completeness, you should add the option to the `url` and `asset` twig functions/template helpers.

---------------------------------------------------------------------------

by stof at 2012-04-16T10:46:06Z

@jalliot adding the option to ``url`` does not make any sense. The difference between ``path`` and ``url`` is that ``path`` generates a path and ``url`` generates an absolute url (thus including the scheme and the hostname)

---------------------------------------------------------------------------

by Tobion at 2012-04-16T12:27:49Z

@stof I guess jalliot meant we could then generate scheme-relative URLs with `url`. Otherwise this would have no equivalent in twig.

---------------------------------------------------------------------------

by jalliot at 2012-04-16T12:34:08Z

@stof Yep I meant what @Tobion said :)

---------------------------------------------------------------------------

by Tobion at 2012-04-18T11:57:04Z

The $relative parameter I added besides the existing $absolute parameter of the `->generate` method was not clear enough. So I merged those into a different parameter `referenceType`. I adjusted all parts of symfony to use the new signature. And also made the default `UrlGenerator` implementation BC with the old style. So almost nobody will recognize a change. The only BC break would be for somebody who implemented his own `UrlGenerator` and did not call the parent default generator.
Using `referenceType` instead of a simple Boolean is much more flexible. It will for example allow a custom generator to support a new reference type like http://en.wikipedia.org/wiki/CURIE

---------------------------------------------------------------------------

by Tobion at 2012-04-18T13:34:58Z

ping @schmittjoh considering your https://github.com/schmittjoh/JMSI18nRoutingBundle/blob/master/Router/I18nRouter.php would need a tiny change

---------------------------------------------------------------------------

by schmittjoh at 2012-04-18T13:37:39Z

Can you elaborate the necessary change?

---------------------------------------------------------------------------

by Tobion at 2012-04-18T13:51:10Z

This PR changes the signature of `generate` to be able to generate path-relative and scheme-relative URLs. So it needs to be
`public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)` and your implementation would need to change `if ($absolute && $this->hostMap) {` to `if (self::ABSOLUTE_URL === $referenceType && $this->hostMap) {`
I can do a PR if this gets merged.

---------------------------------------------------------------------------

by schmittjoh at 2012-04-18T13:52:14Z

If I understand correctly, the old parameter still works, no?

edit: Ah, ok I see what you mean now.

---------------------------------------------------------------------------

by Tobion at 2012-04-18T13:56:33Z

Yeah the old parameter still works but $absolute would also evaluate to true (a string) in your case for non-absolute URLs, i.e. paths.

---------------------------------------------------------------------------

by Tobion at 2012-04-19T21:09:46Z

ping @fabpot

---------------------------------------------------------------------------

by fabpot at 2012-04-20T04:30:18Z

Let's discuss that feature for 2.2.

---------------------------------------------------------------------------

by Tobion at 2012-04-20T10:40:59Z

What are your objections against it? It's already implemented, it works and it adds support for things that are part of a web standard. The BC break is tiny at the moment (almost nobody is affected) because the core UrlGenerator works as before. But if we waited for 2.2 it will be much harder to make the transition because 2.1 is LTS. So I think is makes sense to add it now. Furthermore it makes it much more future-proof as custom generators can more easiliy add support for other link types like CURIE. At the moment a Boolean for absolute URLs is simply too limited and also somehow inconsistent because $absolute = false stands for an absolute path. You see the awkwardness in this naming.

Btw, I added a note in the changelog. And I will add documentation of this feature in symfony-docs once this is merged.

---------------------------------------------------------------------------

by fabpot at 2012-04-20T12:14:32Z

nobody has ever said that 2.1 would be LTS. Actually, I think we are going to wait for 2.3 for LTS.

---------------------------------------------------------------------------

by Tobion at 2012-04-20T12:27:18Z

Well what I meant is, the longer we wait with this, the harder to apply it.
In 04ac1fdba2 you modified `generate` signature for better extensibility that is not even made use of. I think changing `$abolute` param goes in the same direction and has direct use.

I'd like to know your reason to wait for 2.2. Not enough time to review it, or afraid of breaking something, or marketing for 2.2?

---------------------------------------------------------------------------

by stof at 2012-04-20T16:28:27Z

@Tobion the issue is that merging new features forces to postpone the release so that it is tested by enough devs first to be sure there is no blocking bug in it. Big changes cannot be merged when we are hunting the remaining bugs to be able to release.

---------------------------------------------------------------------------

by schmittjoh at 2012-04-20T16:42:11Z

Considering the changes that have been made to the Form component, and are still being made, I think this is in comparison to that a fairly minor change.

Maybe a clearer guideline on the release process, or the direction would help, and avoid confusion, or wrong expectations on contributors' part.

---------------------------------------------------------------------------

by Tobion at 2012-10-05T13:52:11Z

@fabpot this is ready. So if you agree with it, I would create a documentation PR.

---------------------------------------------------------------------------

by stof at 2012-10-13T16:09:47Z

@fabpot what do you think about this PR ?

---------------------------------------------------------------------------

by Crell at 2012-11-01T16:05:01Z

This feels like it's overloading the generate() method to do double duty: One, make a URl based on a route.  Two, make a  URI based on a URI snippet.  Those are two separate operations.  Why not just add a second method that does the second operation and avoid the conditionals?  (We're likely to do that in Drupal for our own generator as well.)

---------------------------------------------------------------------------

by Tobion at 2012-11-01T16:38:39Z

@crell: No, you must have misunderstood something. The generate method still only generates a URI based on a route. The returned URI reference can now also be a relative path and a network path. Thats all.

---------------------------------------------------------------------------

by Tobion at 2012-12-13T18:30:28Z

@fabpot this is ready. It is fully BC! I also improved phpdoc considerably.

---------------------------------------------------------------------------

by Tobion at 2012-12-14T20:51:38Z

@fabpot Do you want me to write documentation for it? I would also be interested to write about the new features of the routing component in general. I wanted to do that anyway and it would probably be a good fit for your "new in symfony" articles.

---------------------------------------------------------------------------

by fabpot at 2012-12-14T20:58:16Z

Im' going to review this PR in the next coming days. And to answer your second question, more documentation or better documentation is always a good thing, so go for it.

---------------------------------------------------------------------------

by Tobion at 2013-01-02T21:50:20Z

@fabpot ping. I added changelog entries.
2013-01-09 10:27:51 +01:00
Fabien Potencier aa8b63b530 merged branch pborreli/typo-2013 (PR #6625)
This PR was merged into the master branch.

Commits
-------

36197dc Fixed typos

Discussion
----------

Fixed typos

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Fixes the following tickets: -
Todo: -
License of the code: MIT
2013-01-09 10:13:49 +01:00
Pascal Borreli 36197dcb83 Fixed typos 2013-01-09 09:07:22 +00:00
Fabien Potencier f07c61d25c merged branch bschussek/issue5844 (PR #6137)
This PR was merged into the master branch.

Commits
-------

586a16e [Validator] Changed DefaultTranslator::getLocale() to always return 'en'
58bfd60 [Validator] Improved the inline documentation of DefaultTranslator
cd662cc [Validator] Added ExceptionInterface, BadMethodCallException and InvalidArgumentException
e00e5ec [Validator] Fixed failing test
cc0df0a [Validator] Changed validator to support pluralized messages by default
56d61eb [Form][Validator] Added BC breaks in unstable code to the CHANGELOG
1e34e91 [Form] Added upgrade instructions to the UPGRADE file
b94a256 [DoctrineBridge] Adapted DoctrineBridge to translator integration in the validator
c96a051 [FrameworkBundle] Adapted FrameworkBundle to translator integration in the validator
92a3b27 [TwigBridge] Adapted TwigBridge to translator integration in the validator
e7eb5b0 [Form] Adapted Form component to translator integration in the validator
46f751c [Validator] Extracted message interpolation logic of ConstraintViolation and used the Translation component for that

Discussion
----------

[Validator] Integrated the Translator in the Validator component

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #5844, #6117
Todo: -
License of the code: MIT
Documentation PR: -

This PR allows to replace the default message substitution strategy in the validator (`strtr()`) by passing an implementation of `Symfony\Component\Translation\TranslatorInterface`. The motivation for this are both #5844 and the need to replace the translation strategy in Drupal's integration of the Validator.

In the stand-alone usage of the validator, both the translator and the default translation domain can now be passed to `ValidatorBuilderInterface`:

```php
$validator = Validation::createValidatorBuilder()
    ->setTranslator(new MyTranslator())
    ->setTranslationDomain('validators')
    ->getValidator();
```

References:

* #5844
* #6117
* #6129
* [Add a validation framework to Drupal 8](http://drupal.org/node/1845546)
* [Add the symfony validator component to core despite Symfony potentially releasing BC-breaking updates after 2.3.](http://drupal.org/node/1849564)

---------------------------------------------------------------------------

by Tobion at 2012-11-28T08:53:25Z

no BC break? Looking at ValidatorBuilderInterface there is definitely one.

---------------------------------------------------------------------------

by bschussek at 2012-11-28T08:55:01Z

ValidatorBuilderInterface is not part of the stable API. You are not supposed to implement this interface.

---------------------------------------------------------------------------

by Tobion at 2012-11-28T09:01:07Z

We're not only documenting bc breaks for stable API, otherwise we could remove 90% of the upgrade file since few methods are tagged with API.
An interface that nobody should implement?

---------------------------------------------------------------------------

by bschussek at 2012-11-28T09:30:02Z

The question is what to consider a BC break. Something will always break for someone. Should we consequently mark everything as BC break? I don't think so.

For example, since 2.1, you are supposed to use `Validation::createValidator*()` for creating a validator. Because of that, I won't consider changing the constructor signature of `Validator` a BC break anymore from 2.1 on.

The same for the unstable interfaces. These are currently meant to be used only, that is, type hint against them and call their methods. But we don't guarantee that we won't add methods to them.

---------------------------------------------------------------------------

by Tobion at 2012-11-28T09:38:19Z

I agree that almost any change could be considered a BC break. So we probably need to better define what a BC break is and what not. Otherwise Symfony will stop evolving after 2.3 because from then on Fabien wanted to prevent BC breaks which is almost impossible in a strict definition of bc break.

---------------------------------------------------------------------------

by fabpot at 2012-11-28T11:37:22Z

BC breaks should always be documented, and we guarantee BC only for things tagged with @api. I'm going to update the docs to make things clearer.

---------------------------------------------------------------------------

by bschussek at 2012-11-28T13:09:57Z

@fabpot I documented these changes now in the CHANGELOG: af99ebb1206ac92889b7193ba1ecc12bf2617e85

Are we sure we want to document *all* BC breaks from now on, even in non-@api code? This could rather scare people looking at our changelogs (lots of BC BREAKS there).

---------------------------------------------------------------------------

by fago at 2012-11-28T17:29:58Z

Unfortunately, it turns out the symfony translator interface does not mach the Drupal translation system as well as we initally thought, see http://drupal.org/node/1852106. Given that, this would integrating the validator component into Drupal even harder, because it introduces the dependency on the (unwanted) translation component. :(

---------------------------------------------------------------------------

by stof at 2012-11-28T18:19:36Z

If this does not help Drupal anyway, maybe #5844 is a better way to manage translations for people using the validator outside forms ?
and the Drupal guys would simply follow a similar approach, but based on their own translator instead of the symfony one.

---------------------------------------------------------------------------

by fago at 2012-11-28T18:50:12Z

Yeah. The only problem I see with the approach of #5844 is that *after* validation only the translated messages are available. We'd need to have access to the untranslated messages also.

---------------------------------------------------------------------------

by fago at 2012-11-29T09:49:47Z

As our translation system handles translating pluralized messages differently, the current ExecutionContextInterface::addViolation() method poses a problem also. We need to pass on - both the single and plural - message, as the message gets chosen during translation, see http://api.drupal.org/api/drupal/core!includes!common.inc/function/format_plural/8
So maybe, we could allow adding an already created ConstraintViolation object also? Then, we could implement a "PluralConstraintViolation" class that takes both message templates.

---------------------------------------------------------------------------

by bschussek at 2012-12-03T15:52:36Z

I updated this PR to support pluralized messages by default in the validator. This should solve the problem of the Drupal guys, because their implementation of `TranslatorInterface::transChoice($id, $number, ...)` can now simply split the $id by pipes (`|`) and pass the parts to their own `format_plural($count, $singular, $plural, ...)` function.

For us, it breaks BC because translation catalog sources had to be adapted.

---------------------------------------------------------------------------

by fabpot at 2012-12-03T16:25:52Z

Most of the XLF files are broken (the end is missing now).

IIUC, we now have a hard dependency on the Translation component, which is something we wanted to avoid.

---------------------------------------------------------------------------

by fabpot at 2012-12-03T16:27:56Z

Oops, clicked on the "comment" button too fast.

So, the dependency is hard (you need to install the dep) but light as we only rely on the translation interface from the component (when using the default translator). It looks acceptable to me, especially because we now use Composer to manage dependencies.

---------------------------------------------------------------------------

by bschussek at 2012-12-03T16:54:10Z

@fabpot Thanks for the hint. Going to fix this.

---------------------------------------------------------------------------

by bschussek at 2012-12-04T11:34:43Z

@fabpot Fixed.

---------------------------------------------------------------------------

by bschussek at 2012-12-07T12:40:24Z

Is there anything missing for this PR to be merged?
2013-01-09 09:22:50 +01:00
Fabien Potencier 84e4f4b23f [Swiftmailer] updated Swiftmailer dep 2013-01-08 20:27:11 +01:00
Fabien Potencier 2b14410a1f updated VERSION for 2.2.0-BETA1 2013-01-08 19:55:25 +01:00
Fabien Potencier aba96c7cae Merge branch '2.1'
* 2.1:
  [Console] Fix style escaping parsing
  [Console] Make style formatter matching less greedy to avoid having to escape when not needed
  [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file.
  [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class.
  [Form] Fixed EntityChoiceList when loading objects with negative integer IDs
  [TwigBundle] There is no CSS visibility of display, should be visible instead
  [Form] corrected source node for a Danish translation
  [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607)
  [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled
  [CssSelector] added css selector with empty string
  [HttpFoundation] Docblock for Request::isXmlHttpRequest() now points to Wikipedia
  [DependencyInjection] refactored code to avoid logic duplication
  [Form] Deleted references in FormBuilder::getFormConfig() to improve performance
  [HttpFoundation] Update docblock for non-working method

Conflicts:
	src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig
	src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig
2013-01-08 19:17:41 +01:00
Fabien Potencier 8321127cda Merge branch '2.0' into 2.1
* 2.0:
  [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file.
  [TwigBundle] There is no CSS visibility of display, should be visible instead
  [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607)
  [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled
  [CssSelector] added css selector with empty string
  [HttpFoundation] Docblock for Request::isXmlHttpRequest() now points to Wikipedia
  [DependencyInjection] refactored code to avoid logic duplication

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml
	src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
	src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php
2013-01-08 19:16:44 +01:00
Fabien Potencier 1949ce0ed7 merged branch hhamon/cs_fix (PR #6621)
This PR was merged into the 2.1 branch.

Commits
-------

2155719 [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class.

Discussion
----------

[2.1] [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Fixes the following tickets: -
Todo: -
License of the code: MIT
2013-01-08 17:57:17 +01:00
Fabien Potencier 835c1b8615 merged branch hhamon/indentation_fix_esi_services_file (PR #6622)
This PR was merged into the 2.0 branch.

Commits
-------

113271c [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file.

Discussion
----------

[2.x] [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Fixes the following tickets: -
Todo: -
License of the code: MIT
2013-01-08 17:57:06 +01:00
Fabien Potencier f24e32c486 merged branch Seldaek/stylefix (PR #6623)
This PR was merged into the 2.1 branch.

Commits
-------

eb93e66 [Console] Fix style escaping parsing
8ca1b80 [Console] Make style formatter matching less greedy to avoid having to escape when not needed

Discussion
----------

[Console] Fix output formatting issues

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT
2013-01-08 17:56:37 +01:00
Jordi Boggiano eb93e66aa7 [Console] Fix style escaping parsing 2013-01-08 17:21:26 +01:00
Jordi Boggiano 8ca1b805ce [Console] Make style formatter matching less greedy to avoid having to escape when not needed 2013-01-08 17:05:32 +01:00
Hugo Hamon 113271c2df [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file. 2013-01-08 16:05:00 +01:00
Bernhard Schussek 586a16e8f8 [Validator] Changed DefaultTranslator::getLocale() to always return 'en' 2013-01-08 15:58:21 +01:00
Bernhard Schussek 58bfd60b0f [Validator] Improved the inline documentation of DefaultTranslator 2013-01-08 15:58:17 +01:00
Hugo Hamon 2155719398 [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class. 2013-01-08 15:45:08 +01:00
Bernhard Schussek cd662ccf7a [Validator] Added ExceptionInterface, BadMethodCallException and InvalidArgumentException 2013-01-08 15:20:14 +01:00
Bernhard Schussek e00e5ecf4e [Validator] Fixed failing test 2013-01-08 14:59:49 +01:00
Bernhard Schussek cc0df0a5af [Validator] Changed validator to support pluralized messages by default
This was implemented in order to satisfy Drupal's requirements for a
singular and a plural message whenever a message is passed to their
implementation of transChoice().
2013-01-08 14:59:49 +01:00
Bernhard Schussek 56d61eb6da [Form][Validator] Added BC breaks in unstable code to the CHANGELOG 2013-01-08 14:45:43 +01:00
Bernhard Schussek 1e34e91909 [Form] Added upgrade instructions to the UPGRADE file 2013-01-08 14:45:16 +01:00
Bernhard Schussek b94a256cc7 [DoctrineBridge] Adapted DoctrineBridge to translator integration in the validator 2013-01-08 14:43:29 +01:00
Bernhard Schussek c96a0511f2 [FrameworkBundle] Adapted FrameworkBundle to translator integration in the validator 2013-01-08 14:43:29 +01:00
Bernhard Schussek 92a3b27a70 [TwigBridge] Adapted TwigBridge to translator integration in the validator 2013-01-08 14:43:29 +01:00
Bernhard Schussek e7eb5b0d7d [Form] Adapted Form component to translator integration in the validator 2013-01-08 14:43:29 +01:00
Bernhard Schussek 46f751ccf2 [Validator] Extracted message interpolation logic of ConstraintViolation and used the Translation component for that 2013-01-08 14:43:29 +01:00
Fabien Potencier 8c320b0dfd merged branch stloyd/bugfix/console_autocomplete (PR #6604)
This PR was merged into the master branch.

Commits
-------

4d7c895 Fix bug where backspacing to an empty string and using the arrow keys would fail. Added test to prevent in future
cd1def3 Fix bad unit test with undefined offset (spotted by @stloyd)
7f149ae [Console] Split tests for `DialogHelper` that tests `ask()` method
e6574de [Console] Fix `stty` reset when using `DialogHelper#ask()` with autocomplete functionality

Discussion
----------

[Console] Fix `DialogHelper#ask()` with autocomplete functionality

Bug fix: yes
Feature addition: no
BC break: no
Symfony2 tests pass: yes

This PR fixes failing test after: 9d94fc7 as well as correctly resets `stty` to prevent _strange_ data showing-up in console:
![console](https://f.cloud.github.com/assets/67402/47882/673a5dae-58ed-11e2-8bab-30a7c41733f5.png)

---------------------------------------------------------------------------

by fabpot at 2013-01-07T17:27:40Z

ping @lmcd

---------------------------------------------------------------------------

by lmcd at 2013-01-08T03:09:51Z

I'm using -1 as a neutral position when incrementing/decrementing the offset using arrow keys. If it started as zero, then it'd be incremented to 1 on down arrow and we'd miss the first (zero-index) match.

An easier fix for this is to replace all `if ($numMatches > 0)` with `if ($numMatches > 0 && -1 !== $ofs)`

Also, this:

    if ($i === 0) {
        $ofs = -1;
        $matches = $autocomplete;
        $numMatches = count($matches);
    }

    // Pop the last character off the end of our string
    $ret = substr($ret, 0, $i);

    $numMatches = 0;

Should be this:

    if ($i === 0) {
        $ofs = -1;
        $matches = $autocomplete;
        $numMatches = count($matches);
    }
    else {
        $numMatches = 0;
    }

    // Pop the last character off the end of our string
    $ret = substr($ret, 0, $i);

Edit: put these parts into a new pull request to avoid confusion https://github.com/symfony/symfony/pull/6614

---------------------------------------------------------------------------

by lmcd at 2013-01-08T03:11:20Z

Good catch on the stty issue 👍

---------------------------------------------------------------------------

by stloyd at 2013-01-08T12:14:01Z

@fabpot @lmcd I have "merged" fixes from: #6614 and removed those `env`s when used with `stty`.

---------------------------------------------------------------------------

by lmcd at 2013-01-08T12:16:05Z

@stloyd Awesome :)
2013-01-08 14:27:43 +01:00
Fabien Potencier 87160a7051 merged branch bschussek/issue6610 (PR #6617)
This PR was merged into the 2.1 branch.

Commits
-------

55aa012 [Form] Fixed EntityChoiceList when loading objects with negative integer IDs

Discussion
----------

[Form] Fixed EntityChoiceList when loading objects with negative integer IDs

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #6610
Todo: -
License of the code: MIT
Documentation PR: -

---------------------------------------------------------------------------

by stof at 2013-01-08T10:21:57Z

wouldn't you need to do the opposite replacement when loading the result ? And shouldn't it be done in the propel bridge too ?

---------------------------------------------------------------------------

by bschussek at 2013-01-08T10:25:29Z

@stof No, indices aren't used for loading the result, just values. Yes this should be done for the propel bridge, but that bridge is missing even the tests for the ID-as-identifier usage. Do you want to create a PR?
2013-01-08 13:06:20 +01:00
Lee McDermott 4d7c895021 Fix bug where backspacing to an empty string and using the arrow keys would fail. Added test to prevent in future 2013-01-08 13:05:24 +01:00
Lee McDermott cd1def3693 Fix bad unit test with undefined offset (spotted by @stloyd) 2013-01-08 12:58:44 +01:00
Joseph Bielawski 7f149ae0aa [Console] Split tests for `DialogHelper` that tests `ask()` method 2013-01-08 12:54:42 +01:00
Joseph Bielawski e6574deb40 [Console] Fix `stty` reset when using `DialogHelper#ask()` with autocomplete functionality 2013-01-08 12:53:29 +01:00
Bernhard Schussek 55aa0120cf [Form] Fixed EntityChoiceList when loading objects with negative integer IDs 2013-01-08 11:08:32 +01:00
Fabien Potencier 05448056d6 merged branch igorw/visibility-display (PR #6612)
This PR was merged into the 2.0 branch.

Commits
-------

8da2b41 [TwigBundle] There is no CSS visibility of display, should be visible instead

Discussion
----------

[TwigBundle] There is no CSS visibility of display, should be visible instead
2013-01-08 09:57:07 +01:00
Fabien Potencier 850cda1e7b merged branch shieldo/patch-9 (PR #6609)
This PR was merged into the 2.1 branch.

Commits
-------

ae3d454 [Form] corrected source node for a Danish translation

Discussion
----------

[Form] corrected source node for a Danish translation
2013-01-08 09:55:29 +01:00
Igor Wiedler 8da2b412b4 [TwigBundle] There is no CSS visibility of display, should be visible instead 2013-01-08 02:14:26 +01:00
Douglas Greenshields ae3d4541a9 [Form] corrected source node for a Danish translation 2013-01-07 22:34:59 +00:00
Fabien Potencier 87290264e3 merged branch ricardclau/improve-creditcard-regexp (PR #6583)
This PR was merged into the master branch.

Commits
-------

5be0042 better regexp, more test cases, added comments about each credit card
cc278af [Validator] Fix `CardSchemeValidator` double violation when value is non-numeric. Making scheme option accept strings in addition to arrays.

Discussion
----------

[Validator] Improve regexp for Credit Cards and some more tests

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo: Ensure these regexps are proper (credit card validation is always a pain)
License of the code: MIT
Documentation PR:

Regarding Cases excluded from new Regular Expressions:

- Credit card lengths should be respected, these regexp cover lengths in http://en.wikipedia.org/wiki/Bank_card_number
- Visa length can only be 16 and 13 (older ones)
- Diners Cards starting by 5 come from a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard (according to http://www.regular-expressions.info/creditcard.html).
- There seems to be JCB cards starting by 2131 and 1800, I could find them is some places, also found these numbers being tested in Credit Card generators, but some people don't cover them. I don't know their story either

Any comments will be much appreciated!

---------------------------------------------------------------------------

by fabpot at 2013-01-06T19:33:27Z

Thanks for working on this. It would be very valuable if you can add information about these regexes as comments (with links to relevant sources -- like what you've done in the PR description). Thanks.

---------------------------------------------------------------------------

by ricardclau at 2013-01-06T21:01:52Z

Always glad to be able to contribute a little bit

@fabpot you mean @link / @see PHPDoc inside CardSchemeValidator.php? Or further comments in this discussion before adding them?

---------------------------------------------------------------------------

by fabpot at 2013-01-06T21:16:48Z

The more information we can add in the class, the better it is.

---------------------------------------------------------------------------

by ricardclau at 2013-01-07T20:56:05Z

I've added comments and included code from #6603 as I've said there. If you need something else, please let me know, once this is merged, #6603 can also be closed

---------------------------------------------------------------------------

by fabpot at 2013-01-07T21:41:40Z

Can you keep the commit from #6603 to keep ownership?

---------------------------------------------------------------------------

by ricardclau at 2013-01-07T21:44:16Z

I actually have thought about that... let me try my git skills :)

---------------------------------------------------------------------------

by ricardclau at 2013-01-07T21:59:16Z

There you go!
2013-01-07 23:10:31 +01:00
Ricard Clau 5be0042be0 better regexp, more test cases, added comments about each credit card 2013-01-07 22:57:38 +01:00
Sebastian Goettschkes cc278aff69 [Validator] Fix `CardSchemeValidator` double violation when value is non-numeric.
Making scheme option accept strings in addition to arrays.
2013-01-07 22:54:50 +01:00
Fabien Potencier a538c42df1 merged branch fabpot/strict-flag-bug (PR #6608)
This PR was merged into the 2.0 branch.

Commits
-------

1d362b8 [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607)

Discussion
----------

[DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607)
2013-01-07 22:47:08 +01:00
Fabien Potencier 1d362b8849 [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607) 2013-01-07 22:36:09 +01:00