Commit Graph

8150 Commits

Author SHA1 Message Date
Dariusz Górecki
2a74ac31d2 Add info about BC Break to CHANGELOG-2.1 and UPGRADE-2.1 2012-01-13 07:16:58 +01:00
Fabien Potencier
741859dc47 merged branch canni/user_comparable_interface2 (PR #2927)
Commits
-------

e23d452 Add info about BC Break to CHANGELOG-2.1
d7ffeb5 Add some more tests, and enforce boolean return value of interface implementations.
9d3a49f When method name is `hasUserChanged` the return boolean should be true (to match question semantics) and false when user has not changed, this commits inverts return statements.
c57b528 Add note about `AdvancedUserInterface`.
3682f62 Refactor `isUserChanged` to `hasUserChanged`
56db4a1 Change names to Equatable
680b108 Suggested fixes ;)
9386583 [BC Break][Security] Moved user comparsion logic out of UserInterface As discussed on IRC meetings and in PR #2669 I came up with implementation. This is option2, I think more elegant.

Discussion
----------

[BC Break][Security][Option2] Moved user comparsion logic out of UserInterface

As discussed on IRC meetings and in PR #2669 I came up with implementation.
This is option2, I think more elegant.

BC break: yes
Feature addition: no/feature move
Symfony2 test pass: yes
Symfony2 test written: yes
Todo: decide about naming

[![Build Status](https://secure.travis-ci.org/canni/symfony.png)](http://travis-ci.org/canni/symfony)

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

by schmittjoh at 2011-12-19T19:33:24Z

This looks much better than the previous PR. Thanks!

One thing, we also discussed this on Doctrine, the name "comparable" is used in most programming languages to perform a real compare operation that is ">", "<", or "=". In this case though, we are specifically interested in equality of two objects (we cannot establish a natural order between these objects). Java has no such interface as all objects naturally have an equals() method, .NET uses "Equatable" which looks a bit odd. Not sure if there are better names.

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

by canni at 2011-12-19T19:34:52Z

I think this is best of "both worlds" we have nice full-featured implementation suitable for most, and if someone needs advanced compare logic just implements interface. @stof @schmittjoh, what do you think?

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

by stof at 2011-12-19T19:36:55Z

@canni I already commented on the code, and I agree with @schmittjoh that the naming can be confusing

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

by jmikola at 2011-12-20T17:33:22Z

I don't mean to bikeshed, but I strongly agree with @schmittjoh about implications of "compare". I'm not concerned with the interface name so much as I am with `compareUser()`. Given that this method returns a boolean, I think it's best to prefix it with `is` (e.g. `isSameUser`, `isUserEqualTo`) or `equals` (e.g. `equalsUser`).

In this PR, the Token class is implementing the interface, so I think having "User" in the method name is a good idea. Naturally, if the interface was intended for User classes, we could do without it.

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

by canni at 2011-12-20T19:00:00Z

@jmikola in this PR Token class does not implement any additional interface, and `compareUser` is `private` and used internally. I don't stand still after this names, I'll update PR as soon as some decision about naming will be done.

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

by jmikola at 2011-12-21T02:29:59Z

@canni: My mistake, I got confused between the Token method and interface method, which you've since renamed in canni/symfony@fcfcd1087b.

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

by mvrhov at 2011-12-21T06:09:45Z

hm. Now I'm going to bike shed. Wouldn't the proper function name be hasUserChanged?

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

by stof at 2011-12-21T10:58:38Z

it would probably be bettter. The meaning of ``true`` and ``false`` would then be the opposite of the current ones but this is not an issue IMO as it is a different method

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

by jstout24 at 2011-12-27T18:08:49Z

@canni nice job

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

by fabpot at 2011-12-30T14:59:11Z

The method `isUserChanged()` must be rename. What about `hasUserChanged()` as @mvrhov suggested or `isUserDifferent()`?

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

by canni at 2012-01-02T11:44:05Z

@fabpot done.

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

by fabpot at 2012-01-02T18:13:40Z

The only missing thing I can think of is adding some unit tests.

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

by canni at 2012-01-10T20:16:25Z

@fabpot is there anything more you think that should done in this PR?

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

by stof at 2012-01-10T20:38:46Z

@canni can you rebase your branch ? it conflicts with the current master according to github

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

by canni at 2012-01-10T20:56:55Z

@stof done.

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

by fabpot at 2012-01-12T18:06:00Z

@canni: Can you just add some information in the CHANGELOG and in the UPGRADE file? That's all I need to merge this PR now. Thanks a lot.

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

by canni at 2012-01-12T18:16:32Z

@fabpot done, and no problem :)
2012-01-12 19:26:40 +01:00
Dariusz Górecki
e23d4520b1 Add info about BC Break to CHANGELOG-2.1 2012-01-12 19:15:35 +01:00
Fabien Potencier
a81ab35045 merged branch henrikbjorn/framework-bundle-composer (PR #3100)
Commits
-------

78ce60c Add config as required
10b3cde [FrameworkBundle] Add missing dependency and recommended libraries fixes #3094

Discussion
----------

[FrameworkBundle] Add missing dependency and recommended libraries

Fixes #3094

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

by fabpot at 2012-01-12T17:31:14Z

You forgot the dependency on config? Is it on purpose

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

by henrikbjorn at 2012-01-12T17:39:20Z

the config is recommended package on the DependencyInjection component.

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

by stof at 2012-01-12T17:40:56Z

@henrikbjorn yeah, but it is *required* dependency for FrameworkBundle, not only recommended

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

by henrikbjorn at 2012-01-12T17:41:56Z

well it will install it by default as it is recommended.

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

by stof at 2012-01-12T17:43:05Z

@henrikbjorn yeah, but it will be skipped if the user asks to avoid recommended packages (the flag is not implemented yet IIRC) which would break FrameworkBundle as it requires the component
2012-01-12 18:49:58 +01:00
Fabien Potencier
6b4e4d95d9 merged branch henrikbjorn/twig-bridge-resources (PR #3099)
Commits
-------

348a3c6 [TwigBridge] Use reflection to get guess the file path for form resources fixes #3093

Discussion
----------

[TwigBridge] Use reflection to guess the file path for form resources

Fixes #3093
2012-01-12 18:49:42 +01:00
Fabien Potencier
02a12b2c5c merged branch kriswallsmith/strpos (PR #3097)
Commits
-------

fe62401 optimized string starts with checks

Discussion
----------

optimized string starts with checks

Doing this with strpos() is slightly faster than substr().

```
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
```

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

by vicb at 2012-01-11T19:58:27Z

How faster ? even if the string is long and do not contain an occurrence of the sub-string ?
Looks like micro-(not)-optimizations to me.

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

by kriswallsmith at 2012-01-11T20:04:26Z

The difference is about 0.1s when repeated 1M times.

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

by vicb at 2012-01-11T20:08:12Z

% would be better (machine & env independant), what string size, what match offset ?
I personally vote against (`substr` is more meaningful to me and I do not like micro-optims)

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

by kriswallsmith at 2012-01-11T20:12:34Z

I personally consider this a coding standard but don't want to bikeshed here :)

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

by vicb at 2012-01-11T20:28:08Z

I have [tried](https://gist.github.com/1596588) at home.
`strpos ` **is** faster unless you have a very long string, probably because you do not need to create a new string, interesting, thanks for the tip.

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

by Tobion at 2012-01-11T22:40:18Z

I think strpos() is more useful. Say you want to change the string you have to replace 2 variables (the text and the length parameter) when using substr(). It could also introduce bugs when they don't match. With strpos() it's only the text.

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

by robocoder at 2012-01-11T22:43:22Z

alternate micro-optimization that doesn't create a temporary string:
```
strncmp($v, "@", 1) === 0
```

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

by Tobion at 2012-01-11T22:47:12Z

@robocoder probably the fastest solution but needs to be benchmarked
2012-01-12 18:48:45 +01:00
Fabien Potencier
fb3513a50e merged branch kriswallsmith/kernel/unnecessary-regex (PR #3104)
Commits
-------

7f7f82a [HttpKernel] removed unnecessary regex

Discussion
----------

[HttpKernel] removed unnecessary regex

The pattern was also flawed because of the unescaped `.`

```
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
```
2012-01-12 18:47:17 +01:00
Fabien Potencier
c185302c0d merged branch canni/fix_collection_validator (PR #3078)
Commits
-------

7f7c2a7 Add prof-of-concept test, this test will fail without changes in previous commit
253eeba [BugFix][Validator] Fix for PHP incosistent behaviour of ArrayAccess

Discussion
----------

[BugFix][Validator] Fix for PHP incosistent behaviour of ArrayAccess

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2779
Todo: -

[![Build Status](https://secure.travis-ci.org/canni/symfony.png)](http://travis-ci.org/canni/symfony)

Because PHP function `array_key_exists` is buggy, it works great with native
PHP `ArrayObject` instances, but hand written implementations of `ArrayAccess`
and `Traversable` objects will fail to work with `CollectionValidator`

Tests from second commit are valid use cases, but without this change, they will fail.
2012-01-12 18:45:54 +01:00
Henrik Bjørnskov
78ce60caeb Add config as required 2012-01-12 18:44:23 +01:00
Kris Wallsmith
7f7f82a53e [HttpKernel] removed unnecessary regex
The pattern was also flawed because of the unescaped `.`
2012-01-12 09:33:03 -08:00
Henrik Bjørnskov
10b3cde57b [FrameworkBundle] Add missing dependency and recommended libraries fixes #3094 2012-01-12 12:27:23 +01:00
Henrik Bjørnskov
348a3c61af [TwigBridge] Use reflection to get guess the file path for form resources fixes #3093 2012-01-12 12:23:44 +01:00
Kris Wallsmith
fe62401907 optimized string starts with checks
Doing this with strpos() is slightly faster than substr().
2012-01-11 11:33:56 -08:00
Fabien Potencier
fa1c946140 fixed some phpdoc 2012-01-11 15:52:51 +01:00
Fabien Potencier
b9a14f0411 merged 2.0 2012-01-11 15:47:52 +01:00
Fabien Potencier
7ee2f6da75 fixed some phpdoc 2012-01-11 15:46:50 +01:00
Fabien Potencier
f57615b4a4 merged branch kriswallsmith/form/validator-fix (PR #3082)
Commits
-------

aa58330 [Form] fixed flawed condition

Discussion
----------

[Form] fixed flawed condition

The validate() method always returns an object. The test is whether there are violations in that object.

```
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
```

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

by fabpot at 2012-01-10T21:22:10Z

What about removing the if condition altogether?

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

by kriswallsmith at 2012-01-10T21:23:55Z

This way we avoid creating an `ArrayIterator` for no reason.
2012-01-11 08:15:19 +01:00
Fabien Potencier
92c048340b merged branch drak/psr0 (PR #3089)
Commits
-------

39f1ecd [ClassLoader] Update PSR-0 reference.

Discussion
----------

[ClassLoader] Update reference to PSR-0

Bug fix: no
Feature addition: n/a
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-01-11 08:14:47 +01:00
Fabien Potencier
1b59259c00 merged branch vicb/stopwatch (PR #3088)
Commits
-------

c0ad1ac [HttpKernel] Minor fixes in the Stopwatch

Discussion
----------

[HttpKernel] Minor fixes in the Stopwatch

Not a breakthrough, fixing `'0'` handling at 2 places, some re factoring (fluid interface)
2012-01-11 08:14:28 +01:00
Drak
39f1ecd96d [ClassLoader] Update PSR-0 reference. 2012-01-11 09:27:00 +05:45
Victor Berchet
c0ad1ac170 [HttpKernel] Minor fixes in the Stopwatch 2012-01-10 22:23:16 +01:00
Fabien Potencier
a8f5875292 merged branch hhamon/dead_code_cleanup (PR #3086)
Commits
-------

f750e54 [HttpKernel] removed unused local $event variable in Stopwatch::stopSection() method.
defdac6 [DependencyInjection] removed unused private property $parameterBag in ResolveParameterPlaceHoldersPass::process() method.
1ad3d86 [DependencyInjection] removed unused $compiler local variable in RepeatedPass::process() method.
7088d94 [DependencyInjection] fixed wrong local variable name in RemoveUnusedDefinitionsPass::process() method.
a7f857d [Console] removed unused $position parameter in Shell::autocompleter() method.
ef6297a [BrowserKit] removed unused $name variable in CookieJar::allValues() method.

Discussion
----------

Dead code cleanup
2012-01-10 22:18:59 +01:00
Hugo Hamon
f750e5420e [HttpKernel] removed unused local $event variable in Stopwatch::stopSection() method. 2012-01-10 22:07:40 +01:00
Hugo Hamon
defdac6d0d [DependencyInjection] removed unused private property $parameterBag in ResolveParameterPlaceHoldersPass::process() method. 2012-01-10 22:07:35 +01:00
Hugo Hamon
1ad3d8673b [DependencyInjection] removed unused $compiler local variable in RepeatedPass::process() method. 2012-01-10 22:07:30 +01:00
Hugo Hamon
7088d942ce [DependencyInjection] fixed wrong local variable name in RemoveUnusedDefinitionsPass::process() method. 2012-01-10 22:07:25 +01:00
Hugo Hamon
a7f857da87 [Console] removed unused $position parameter in Shell::autocompleter() method. 2012-01-10 22:07:21 +01:00
Hugo Hamon
ef6297afdb [BrowserKit] removed unused $name variable in CookieJar::allValues() method. 2012-01-10 22:07:07 +01:00
Dariusz Górecki
d7ffeb5844 Add some more tests, and enforce boolean return value of interface implementations. 2012-01-10 21:55:05 +01:00
Dariusz Górecki
9d3a49f065 When method name is hasUserChanged the return boolean should be true
(to match question semantics) and false when user has not changed,
this commits inverts return statements.
2012-01-10 21:55:05 +01:00
Dariusz Górecki
c57b528cca Add note about AdvancedUserInterface. 2012-01-10 21:55:05 +01:00
Dariusz Górecki
3682f62a07 Refactor isUserChanged to hasUserChanged 2012-01-10 21:55:05 +01:00
Dariusz Górecki
56db4a1d26 Change names to Equatable 2012-01-10 21:55:04 +01:00
Dariusz Górecki
680b1086e9 Suggested fixes ;) 2012-01-10 21:55:04 +01:00
Dariusz Górecki
9386583b19 [BC Break][Security] Moved user comparsion logic out of UserInterface
As discussed on IRC meetings and in PR #2669 I came up with implementation.
This is option2, I think more elegant.

BC break: yes
Feature addition: no/feature move
Symfony2 test pass: yes
Symfony2 test written: yes
Todo: feedback needed
2012-01-10 21:54:56 +01:00
Kris Wallsmith
aa58330047 [Form] fixed flawed condition 2012-01-10 09:16:51 -08:00
Kris Wallsmith
753c06761a [FrameworkBundle] added $view['form']->csrfToken() helper 2012-01-10 05:18:23 -08:00
Kris Wallsmith
e1aced89fd [Twig] added {{ csrf_token() }} helper 2012-01-10 05:16:32 -08:00
Dariusz Górecki
7f7c2a7094 Add prof-of-concept test, this test will fail without changes in previous commit 2012-01-10 11:51:28 +01:00
Dariusz Górecki
253eebad88 [BugFix][Validator] Fix for PHP incosistent behaviour of ArrayAccess
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2779
Todo: -

Because PHP function `array_key_exists` is buggy, it works great with native
PHP `ArrayObject` instances, but hand written implementations of `ArrayAccess`
and `Traversable` objects will fail to work with `CollectionValidator`
2012-01-10 11:06:00 +01:00
Fabien Potencier
74961c8d22 merged branch maerlyn/hungarian_translation_2.0 (PR #3076)
Commits
-------

63e7f95 updated hungarian translations

Discussion
----------

Hungarian translations for 2.0

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -

I have translated the trans-unit #41.
2012-01-10 10:34:36 +01:00
Maerlyn
63e7f95f60 updated hungarian translations 2012-01-10 09:39:04 +01:00
Fabien Potencier
009e6d739e merged branch Seldaek/route_redirect (PR #3074)
Commits
-------

af32590 [FrameworkBundle] Use only _route_params to generate redirect routes

Discussion
----------

[FrameworkBundle] Use only _route_params to generate redirect routes

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes

Routes in RedirectController are generated using all request attributes, which is inconvenient since I abuse request attributes to store other things (device types and such) relevant to the app. It renders the RedirectController useless since it adds unrelated query parameters to URLs it creates.
2012-01-10 07:35:44 +01:00
Fabien Potencier
a3ddc8e9b9 merged branch pulzarraider/updated_sk_validator (PR #3072)
Commits
-------

c8bafcf Updated validators.sk.xlf file

Discussion
----------

[FrameworkBundle] Slovak translations updated

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

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

by stof at 2012-01-09T20:33:53Z

can you send the ids below 41 to the 2.0 branch ? Only 42-28 are new for 2.1

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

by pulzarraider at 2012-01-09T20:39:42Z

Done, see #3073.
2012-01-10 07:35:33 +01:00
Fabien Potencier
1cbb041b99 merged branch pulzarraider/updated_sk_validator_2_0 (PR #3073)
Commits
-------

127cf52 Updated validators.sk.xlf file (for Symfony 2.0)

Discussion
----------

[FrameworkBundle] Slovak translations updated

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This PR is for Symfony 2.0.
2012-01-10 07:35:20 +01:00
Jordi Boggiano
af3259026d [FrameworkBundle] Use only _route_params to generate redirect routes 2012-01-09 21:29:20 +01:00
Andrej Hudec
127cf52d89 Updated validators.sk.xlf file (for Symfony 2.0) 2012-01-09 21:20:15 +01:00
Andrej Hudec
c8bafcfd0f Updated validators.sk.xlf file 2012-01-09 20:57:39 +01:00
Fabien Potencier
46b00b1001 merged branch Seldaek/console_tests (PR #3071)
Commits
-------

bea7a9c [Console] Fix tests on windows

Discussion
----------

[Console] Fix tests on windows

Rebased version of #3059 after merging #3066. This code isn't in 2.0 but still needs fixing.
2012-01-09 20:35:44 +01:00
Jordi Boggiano
bea7a9c865 [Console] Fix tests on windows 2012-01-09 17:05:16 +01:00