Commit Graph

12593 Commits

Author SHA1 Message Date
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
Alexander
73db84fd5e [Security] Move translations file to 'security' domain 2013-01-07 21:11:25 +01:00
Alexander
324703a9ff [Security] Switch to English messages as message keys 2013-01-07 21:11:24 +01:00
Alexander
aa7476967a [Security] Fix CS + unreachable code 2013-01-07 21:11:19 +01:00
Alexander
2d7a7ba139 [Security] Fix AuthenticationException serialization 2013-01-07 20:58:58 +01:00
Alexander
50d5724c23 [Security] Introduced UsernameNotFoundException#get/setUsername 2013-01-07 20:58:58 +01:00
Alexander
39da27a06d [Security] Removed get/setExtraInformation, added get/set(Token|User) 2013-01-07 20:58:58 +01:00
Alexander
837ae15102 [Security] Add note about changed constructor to changelog 2013-01-07 20:58:58 +01:00
Alexander
d6c57cff6f [FrameworkBundle] Register security exception translations 2013-01-07 20:58:58 +01:00
Alexander
d7129b9a7e [Security] Fix exception constructors called in UserChecker 2013-01-07 20:58:58 +01:00
Alexander
0038fbb8b6 [Security] Add initial translations for AccountStatusException childs 2013-01-07 20:58:58 +01:00
Alexander
50e2cfc1f5 [Security] Add custom getMessageKey AccountStatusException childs 2013-01-07 20:58:58 +01:00
Alexander
1147977212 [Security] Fix InsufficientAuthenticationException constructor calls 2013-01-07 20:58:58 +01:00
Alexander
79430b8238 [Security] Fix AuthenticationServiceException constructor calls 2013-01-07 20:58:58 +01:00
Alexander
42cced4c97 [Security] Fix AuthenticationException constructor calls 2013-01-07 20:58:57 +01:00
Alexander
963a1d7b81 [Security] Add initial translations for the exceptions 2013-01-07 20:58:57 +01:00
Alexander
ed6eed4c36 [Security] Add getMessageKey and getMessageData to auth exceptions 2013-01-07 20:58:57 +01:00
Alexander
694c47ce96 [Security] Change signature of AuthenticationException to match \Exception 2013-01-07 20:58:57 +01:00
Fabien Potencier
b378964dbd Revert "merged branch stloyd/feature/kernel_secret_change (PR #6598)"
This reverts commit dbca0403b8, reversing
changes made to 1e6258846a.
2013-01-07 17:26:10 +01:00
Fabien Potencier
c223eca2ad merged branch bschussek/issue6558_2 (PR #6580)
This PR was merged into the master branch.

Commits
-------

bcc5552 [Form] Protected methods in FormConfigBuilder and FormBuilder from being called when it is turned into a FormConfigInterface instance
fee1bf5 [Form] Introduced base ExceptionInterface

Discussion
----------

[Form] Protected methods in FormConfigBuilder and FormBuilder

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

When a form is created, a `FormConfigInterface` instance is passed to the constructor of `Form` and then accessible via `getConfig()`. For performance reasons, `FormBuilder` also implements `FormConfigInterface` and is passed here directly instead of copying its values to a new `FormConfig` instance, although protected from further modifications.

In addition to the already existing guard clauses in the setters, this PR adds guard clauses to the getters of `FormBuilder` to prevent misuse of the "config" object giving unexpected results.

Additionally, this PR introduces first improvements of the form's `Exception\` namespace as described in  #6549.

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

by mvrhov at 2013-01-05T18:19:04Z

@bschussek I don't have the time to review this one, but please do not over optimize. We do a lot of weird things. e.g. I have the following code in one of my models.

```php
public function validateEmail(ExecutionContextInterface $context)
{
    if ((null !== $this->product) && (in_array($this->product->getType(), array(ProductTypeEnum::Software, ProductTypeEnum::Subscription)))) {
        /** @var $form Form */
        $form = $context->getRoot();
        if (($form instanceof Form) && ('foo' == $form->getConfig()->getOption('app_name'))) {
            $context->validate($this, 'email', 'Email');
        }
    }
}
```

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

by bschussek at 2013-01-05T18:46:17Z

@mvrhov Absolutely no problem. Most people will use methods from `FormConfigInterface` on the result of `getConfig()`, because that's the type hinted return value, and that's the way it should be. I don't even know how many people are aware that `getConfig()` returns the builder object.

This PR is for rare cases where people write forward-incompatible hacks by accessing `FormBuilder` methods like `get()`, `getParent()` or the like on `getConfig()` (I don't know why anyone would do this, but you never know...)

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

by vicb at 2013-01-07T11:08:34Z

> Backwards compatibility break: no

Really ?

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

by vicb at 2013-01-07T12:26:22Z

Changing `FormException` from a class to an interface is a BC break (`new FormException()`)

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

by bschussek at 2013-01-07T12:41:20Z

@vicb Fair enough ;) I adapted the CHANGELOG and UPGRADE-2.2.

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

by fabpot at 2013-01-07T15:50:03Z

This PR break the tests.

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

by bschussek at 2013-01-07T15:50:34Z

I just fixed them and they run on my computer. I'm not sure why Travis fails again.

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

by bschussek at 2013-01-07T15:56:41Z

Travis merged the wrong commit. It merged 42c8987f350650a42d8c968d32cde50fc5d548c0 - see the merge commit here 766f7fe958ea69a302bed6298e55a3001a51e2b8 - when it should have merged cd3f4f9dfe43a526c23f30e16354ff11489b9db1.
2013-01-07 17:03:02 +01:00
Fabien Potencier
37c495207b merged branch stloyd/bugfix/mimeguesser_functions (PR #6601)
This PR was merged into the 2.0 branch.

Commits
-------

3195122 [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled

Discussion
----------

[HttpFoundation] Check if required shell functions are not disabled

Rebased to `2.0` & squashed version of #6526.
2013-01-07 17:01:04 +01:00
Bernhard Schussek
bcc5552de4 [Form] Protected methods in FormConfigBuilder and FormBuilder from being called when it is turned into a FormConfigInterface instance 2013-01-07 16:58:41 +01:00
Bernhard Schussek
fee1bf5448 [Form] Introduced base ExceptionInterface 2013-01-07 16:58:41 +01:00
Fabien Potencier
c4a2a2ba2b merged branch drak/flashcountpt2 (PR #6443)
This PR was merged into the master branch.

Commits
-------

0cf9fcb [HttpFoundation] Deprecated count() and \Countable

Discussion
----------

[HttpFoundation] Deprecated count() and \Countable

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

The docblock is done in #6423 so will be merged up.

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

by stloyd at 2013-01-07T11:19:20Z

@fabpot ping

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

by drak at 2013-01-07T11:22:54Z

This should be OK for merge as the solution was agreed with @fabpot before making the PR.

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

by fabpot at 2013-01-07T11:24:50Z

@drak Can you add an entry in the CHANGELOG stating that this is a BC break?

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

by drak at 2013-01-07T15:31:21Z

@fabpot - There doesnt seem to be a CHANGELOG-2.2 in the master branch... where should I place the information?

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

by Tobion at 2013-01-07T15:46:25Z

@drak just in the CHANGELOG under the 2.2. header

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

by fabpot at 2013-01-07T15:48:43Z

Here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/CHANGELOG.md

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

by drak at 2013-01-07T15:48:45Z

@Tobion - thanks, I forgot it's in the package root, not the repo root. :)

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

by drak at 2013-01-07T15:52:37Z

@fabpot - updated changelog, squashed  and rebased.
2013-01-07 16:55:41 +01:00
Fabien Potencier
cd04bd7a12 merged branch drak/flashcount (PR #6423)
This PR was merged into the 2.1 branch.

Commits
-------

8513777 [HttpFoundation] Update docblock for non-working method

Discussion
----------

[HttpFoundation] Update docblock for non-working method

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

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

by piotrpasich at 2012-12-19T21:32:24Z

I think that we shouldn't comment it as not working but add new methods called countFlashes and countFlashesTypes. CountFlashesTypes should return count($this->flashBag) and countFlashes should count all items in every array inside flashbag.

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

by drak at 2012-12-20T17:43:38Z

ping @fabpot
2013-01-07 16:55:04 +01:00
Drak
0cf9fcb304 [HttpFoundation] Deprecated count() and \Countable 2013-01-07 15:50:53 +00:00
Fabien Potencier
87a85b6696 merged branch bschussek/issue6558 (PR #6578)
This PR was merged into the 2.1 branch.

Commits
-------

33e9d00 [Form] Deleted references in FormBuilder::getFormConfig() to improve performance

Discussion
----------

[Form] Deleted references in FormBuilder::getFormConfig() to improve performance

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

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

by vicb at 2013-01-07T11:09:24Z

> Backwards compatibility break: no

Really ?

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

by vicb at 2013-01-07T12:27:37Z

Adding a public method is a BC break.

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

by bschussek at 2013-01-07T12:42:14Z

The method is inherited from the parent class, so the change should not affect BC.

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

by vicb at 2013-01-07T13:27:21Z

my bad.
2013-01-07 16:44:13 +01:00
srsbiz
3195122905 [HttpFoundation] Check if required shell functions for FileBinaryMimeTypeGuesser are not disabled 2013-01-07 14:18:29 +01:00
Fabien Potencier
43d056fb15 merged branch Tobion/static-compile (PR #6491)
This PR was squashed before being merged into the master branch (closes #6491).

Commits
-------

5d264ce [Routing] made RouteCompilerInterface::compile static

Discussion
----------

[Routing] made RouteCompilerInterface::compile static

bc break: yes but probably nobody affected

It makes much more sense that the compile method is static because having instances of a compiler is strange. Also the compiler could not use DI or anything anyway as the `Route` class was instantiating compiler instances itself and was assuming there are no constructor arguments.
2013-01-07 12:20:12 +01:00
Tobias Schultze
5d264ce9b6 [Routing] made RouteCompilerInterface::compile static 2013-01-07 12:20:12 +01:00
Fabien Potencier
5adecd7780 merged branch lmcd/autocomplete-cleanups (PR #6594)
This PR was squashed before being merged into the master branch (closes #6594).

Commits
-------

9d94fc7 [Console] Autocomplete cleanups/optimisations

Discussion
----------

[Console] Autocomplete cleanups/optimisations

I know the optimisations to this code are getting kinda ridiculous, but I found a few more things to tidy up.
2013-01-07 12:16:36 +01:00