Commit Graph

7055 Commits

Author SHA1 Message Date
Christophe Coevoet
3b260d268b Refactored the collector to separate the loggers per connection 2012-01-23 09:22:30 +01:00
Fabien Potencier
9d8f386bc6 merged branch 1ed/hungarian-validator-messages (PR #3170)
Commits
-------

0f680c2 [FrameworkBundle] updated hungarian validator messages

Discussion
----------

[FrameworkBundle] updated hungarian validator messages
2012-01-22 16:53:36 +01:00
Fabien Potencier
35a61b3a52 [HttpKernel] added arguments to ExceptionHandler (closes #2739) 2012-01-22 16:53:27 +01:00
Fabien Potencier
63adb97cf2 Revert "merged branch blogsh/dynamic_constraints (PR #3114)"
This reverts commit 6b9a355fb0, reversing
changes made to 811ead8589.
2012-01-22 16:50:02 +01:00
Gábor Egyed
0f680c2cc9 [FrameworkBundle] updated hungarian validator messages 2012-01-22 15:37:28 +01:00
Fabien Potencier
53b3c8304f [HttpKernel] fixed indentation of generated HTML in ExceptionHandler 2012-01-22 11:20:16 +01:00
Fabien Potencier
8d79ebc8ce [HttpKernel] added some unit tests for ExceptionHandler and
FlattenException
2012-01-22 11:19:40 +01:00
Fabien Potencier
c290d829a7 merged branch gustavopiltcher/master (PR #2858)
Commits
-------

4a797df Oracle issues
81d73bb Oracle issues
2316b21 Oracle issues
315bfc4 just update
b20b15b Oracle 10 issues

Discussion
----------

Oracle issues

updated with some adjustments required by stof

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

by fabpot at 2011-12-13T07:24:12Z

@schmittjoh: Can you have a look at this PR?

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

by fabpot at 2011-12-24T08:19:37Z

Can you squash your commit before I merge your PR? Thanks.
2012-01-22 10:45:17 +01:00
Fabien Potencier
8358cbf7a6 merged branch kriswallsmith/csrf-token-helper (PR #3080)
Commits
-------

753c067 [FrameworkBundle] added $view['form']->csrfToken() helper
e1aced8 [Twig] added {{ csrf_token() }} helper

Discussion
----------

[Twig] [FrameworkBundle] added CSRF token helper

I've added a templating helper and Twig function for generating a CSRF token without the overhead of creating a form.

```html+jinja
<form action="{{ path('user_delete', { 'id': user.id }) }}" method="post">
    <input type="hidden" name="_method" value="delete">
    <input type="hidden" name="_token" value="{{ csrf_token('delete_user_' ~ user.id) }}">
    <button type="submit">delete</button>
</form>
```

```php
<?php

class UserController extends Controller
{
    public function delete(User $user, Request $request)
    {
        $csrfProvider = $this->get('form.csrf_provider');
        if (!$csrfProvider->isCsrfTokenValid('delete_user_'.$user->getId(), $request->request->get('_token')) {
            throw new RuntimeException('CSRF attack detected.');
        }

        // etc...
    }
}
```

The test that is failing on Travis appears to be unrelated, but I may be wrong?

```
1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #1 ('de')
RuntimeException: OUTPUT:
Catchable fatal error: Argument 3 passed to Symfony\Bundle\FrameworkBundle\Controller\TraceableControllerResolver::__construct() must be an instance of Symfony\Component\HttpKernel\Debug\Stopwatch, instance of Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser given, called in /tmp/2.1.0-DEV/StandardFormLogin/cache/securitybundletest/appSecuritybundletestDebugProjectContainer.php on line 94 and defined in /home/vagrant/builds/kriswallsmith/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/TraceableControllerResolver.php on line 37
```

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

by pablodip at 2012-01-10T14:18:45Z

As you don't need forms to use the csrf provider, how about putting its service without the form prefix? It could even make sense to put the CsrfProvider as a component since you can use it standalone and in more cases than only forms. It would be a small component though.

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

by Tobion at 2012-01-10T17:54:14Z

I think it would be more clear to generate the token in the controller. Doing so in the template will spread the CSRF intention across template and controller. So I don't think this extension is necessary.

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

by kriswallsmith at 2012-01-10T17:58:14Z

@pablodip I'm open to the idea of a Csrf component. This would be a good place for some nonce classes as well.

@Tobion I disagree. One use case is for a list of users, each with a delete form. Iterating over the users in the controller and generating a token for each, just to iterate over them again in the view is a waste and adds complexity.

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

by Tobion at 2012-01-10T18:05:14Z

I see. But I don't understand why the intention needs to be different for each user to delete. Usually the intention is the same for each form type. I thought this is enough.

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

by kriswallsmith at 2012-01-10T18:06:13Z

Yes, a static intention would suffice.

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

by Tobion at 2012-01-10T18:07:08Z

Then your use case is not valid anymore.

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

by Tobion at 2012-01-10T18:12:25Z

I would suggest to make a cookbook article out of it about how to create a simple form without the form component.
And include such things as validating the result using the validator component and checking the CSRF.

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

by kriswallsmith at 2012-01-10T21:32:50Z

This helper makes it easier to use CSRF protection without a form and we should make it as easy as possible. Spreading the intention across controller and template is not concerning to me. Either way, a cookbook entry is a great idea.

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

by Tobion at 2012-01-10T21:47:12Z

Well, it's just one line more without this helper. So I disagree it makes it really easier when you know how to use the CsrfProvider which is a pre-condition anyway since you must still validate its correctness by hand.

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

by kriswallsmith at 2012-01-13T13:24:15Z

Another use case is when rendering a page with a bunch of simple buttons with different intentions: delete user, delete comment, follow, unfollow... Creating all of these in the controller just leads to spaghetti.

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

by jwage at 2012-01-17T21:55:53Z

👍 lots of use cases for something like this @OpenSky
2012-01-22 10:31:29 +01:00
Fabien Potencier
6b9a355fb0 merged branch blogsh/dynamic_constraints (PR #3114)
Commits
-------

92f820a Renamed registerConstraints to loadDynamicValidatorMetadata
dd12ff8 CS fix, getConstraints renamed
09c1911 [Validator] Improved dynamic constraints
54cb6e4 [Validator] Added dynamic constraints

Discussion
----------

[Validator] Dynamic constraints

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

By now the Validator component is based on a per-class configuration of
constraints, but in some cases it might be neccessary to add new constraints
dynamically at runtime.
This pull request adds a "ConstraintProviderInterface" to the Validator component. If an object is validated that implements this interface the method "getConstraints" is used to add dynamic constraints:

    class User implements ConstraintProviderInterface
    {
        protected $isPremium;
        protected $paymentInformation;

        public function getConstraints(ClassMetadata $metadata)
        {
            if ($this->isPremium) {
                $metadata->addPropertyConstraint('paymentInformation', new NotBlank());
            }
        }
    }

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

by alexandresalome at 2012-01-15T11:20:04Z

Related to #1151

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

by canni at 2012-01-16T09:22:28Z

👍

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

by bschussek at 2012-01-16T12:32:44Z

I think this is a good addition. I think we still have a naming problem though. When constraints are loaded using a static method, the default name for the loader method is `loadValidatorMetadata`. Since the method for dynamic constraint loading is basically the same, I think the two names should be related.

Solution (1): Rename the method in your interface to `loadDynamicValidatorMetadata`. Ugly and long.

    class MyClass implements ConstraintProviderInterface
    {
        public static loadValidatorMetadata(ClassMetadata $metadata) ...

        public loadDynamicValidatorMetadata(ClassMetadata $metadata) ...
    }

Solution (2): Rename the default method name in `StaticMethodLoader` to `registerConstraints` and adjust the docs. Breaks BC.

    class MyClass implements ConstraintProviderInterface
    {
        public static registerConstraints(ClassMetadata $metadata) ...

        public registerDynamicConstraints(ClassMetadata $metadata) ...
    }

@fabpot: Are we allowed to break BC here? If not, we should probably stick to (1).

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

by fabpot at 2012-01-16T12:36:14Z

I would prefer to not break BC if possible.

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

by blogsh at 2012-01-16T15:25:46Z

So "loadDynamicValidatorMetadata" would be the best solution?

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

by althaus at 2012-01-17T13:39:19Z

>So "loadDynamicValidatorMetadata" would be the best solution?

Sounds fine for me based on @bschussek's comment.
2012-01-22 10:26:39 +01:00
Fabien Potencier
54e14e7b11 merged branch sprain/sprain/xml-encoder-cdata (PR #3134)
Commits
-------

9cb513f Now… no more tabs!
7f34643 [Pull Request 3134] Improved code based on comments
90abc0f [Serializer][XmlEncoder] add CDATA padding only if necessary

Discussion
----------

[Serializer][XmlEncoder] add CDATA padding only if necessary

Changed XML encoder so CDATA padding is only added to value if necessary.

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

by fabpot at 2012-01-17T21:34:59Z

You should add some unit tests.
2012-01-22 10:17:12 +01:00
Fabien Potencier
90fcbde685 merged branch canni/fix_cs (PR #3146)
Commits
-------

3cfaade [CS] Fix usage of assertCount

Discussion
----------

[CS] Fix usage of assertCount

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

[![Build Status](https://secure.travis-ci.org/canni/symfony.png)](http://travis-ci.org/canni/symfony)
2012-01-22 10:15:34 +01:00
Fabien Potencier
c7ec49c624 merged branch lstrojny/feature/form-http-delete (PR #3159)
Commits
-------

0b7e2e0 Support for DELETE method in forms

Discussion
----------

[Form] Support DELETE HTTP verb

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

As `Symfony\Component\HttpFoundation\Request` already support DELETE requests nicely by parsing the request for us, support for the HTTPs DELETE verb can be easily done.

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

by mvrhov at 2012-01-20T06:00:49Z

This is wrong. The body for DELETE method is supposed to be empty or if present ignored.
Also the DELETE is supposed to remove the resource identified by uri, so the same code as for GET should be executed.

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

by lstrojny at 2012-01-20T08:56:22Z

I don’t think that’s the case. The HTTP standard does not state explicitly that DELETE does not have a body. See this [StackOverflow thread](http://stackoverflow.com/questions/2539394/rest-http-delete-and-parameters)
2012-01-22 10:05:04 +01:00
Fabien Potencier
09694999b8 merged branch timewasted/patch-1 (PR #3158)
Commits
-------

9e55cda Only call recover() when spool is a Swift_FileSpool
d2a0c74 Use if/else instead of ternary operator
15c666b Add a "recover-timeout" option to allow recovering messages that have taken too long to send

Discussion
----------

[SwiftmailerBundle] Add a "recover-timeout" option to swiftmailer:spool:send

This would allow for easy resending of messages that were marked as being sent, but for whatever reason were never actually sent.
2012-01-22 09:38:58 +01:00
Fabien Potencier
2c962419dc merged branch umpirsky/serbian-translation-update (PR #3167)
Commits
-------

f6b3ea2 New validation messages and translated to Serbian language.

Discussion
----------

New validation messages and translated to Serbian language.

It would be nice for translators to be notified somehow when new validation messages appear. I copied those from French translation, not sure if that is the right way to go?

Also, in addition, I would like to contribute sr@latin translation. To explain, Serbian language have dual alphabet, both cyrillic and latin. I'm not sure if Symfony locale supports locale variants? Can you suggest right translation file name for this?

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

by stof at 2012-01-21T19:20:31Z

Please send the ids up to 41 to the 2.0 branch. Only 42 and above are new in 2.1

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

by stof at 2012-01-21T19:23:48Z

Regarding serbian latin translations, there is an issue here: both cyrillic and latin serbian share the same locale id ``sr_SP``

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

by stof at 2012-01-21T19:33:01Z

ok, looking a bit more about it, it seems like the right way to handle this is to use ``sr_Latn`` and ``sr_Cyrl`` for the 2 variants

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

by umpirsky at 2012-01-21T20:28:37Z

But ids 42 and above can be merged to master (2.1), right?

I think they share `sr_RS`, not `sr_SP` as you said.

So, `validators.sr.xlf` should be renamed to `validators.sr_Cyrl.xlf` and for latig added `validators.sr_Latn.xlf`?

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

by stof at 2012-01-21T21:00:18Z

yeah, but previous ids should be merged in 2.0 first to avoid merge conflicts later

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

by umpirsky at 2012-01-21T22:37:15Z

Done https://github.com/symfony/symfony/pull/3168
2012-01-22 07:34:36 +01:00
Fabien Potencier
a5220313f6 Merge branch '2.0'
* 2.0:
  Updated Serbian translation.
  fixed CS
  [Locale][Testing] Fixed breaking tests if 'intl' extension is not installed (#3139)
  [Bridge] [Twig] fixed typo in a comment of the Twig FormExtension extension.
2012-01-22 07:33:58 +01:00
Sasa Stamenkovic
1f733e1168 Updated Serbian translation. 2012-01-21 23:34:49 +01:00
Fabien Potencier
cbb184c076 merged branch alexandresalome/fix-form-choice-translation-expanded (PR #3166)
Commits
-------

0513eb1 [Form] Pass translation domain to the sub-forms when choice list is expanded

Discussion
----------

[Form] Pass translation domain to the sub-forms when choice list is expanded

* Bug fix: yes
* Tests pass: yes
* Feature addition: no
* BC compatibility break: no

When you have a select list with ``translation_domain``, you loose translations by expanding the list.

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

by stof at 2012-01-21T14:55:31Z

👍

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

by fabpot at 2012-01-21T16:51:17Z

Why not doing that in the 2.0 branch instead?

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

by stof at 2012-01-21T17:26:32Z

@fabpot because the support of translation domains is a 2.1 feature
2012-01-21 21:20:56 +01:00
Sasa Stamenkovic
f6b3ea2d07 New validation messages and translated to Serbian language. 2012-01-21 19:53:48 +01:00
alexandresalome
0513eb1a4f [Form] Pass translation domain to the sub-forms when choice list is expanded 2012-01-21 14:19:08 +01:00
Ryan
9e55cdaeec Only call recover() when spool is a Swift_FileSpool 2012-01-21 00:49:31 -08:00
Lars Strojny
0b7e2e035a Support for DELETE method in forms 2012-01-20 01:04:31 +01:00
Ryan
d2a0c74e22 Use if/else instead of ternary operator 2012-01-19 13:01:29 -08:00
Ryan
15c666bf43 Add a "recover-timeout" option to allow recovering messages that have taken too long to send 2012-01-19 12:11:55 -08:00
Sebastian Hörl
92f820a094 Renamed registerConstraints to loadDynamicValidatorMetadata 2012-01-18 22:24:42 +01:00
Dariusz Górecki
3cfaade8f7 [CS] Fix usage of assertCount
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-01-18 14:42:47 +01:00
Fabien Potencier
812c72ad8c fixed CS 2012-01-18 13:29:06 +01:00
Dariusz Górecki
693d1ec237 [Form] Do not render default ID attribute on empty form name
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This is cleanup after enabling empty form names, now form with empty name
will not render the default `id="form"` container attribute.
Developers can extend/override this behaviour by standard form theming methods.
2012-01-18 10:59:46 +01:00
Jonathan Ingram
076f5717a7 Added missing interface method and updated phpDoc param 2012-01-18 17:05:44 +11:00
Hugo Hamon
d0da2f921a [Bridge] [Twig] fixed typo in a comment of the Twig FormExtension extension. 2012-01-17 16:45:13 +01:00
Manuel Reinhard
9cb513f962 Now… no more tabs! 2012-01-17 14:18:32 +01:00
Manuel Reinhard
7f3464386b [Pull Request 3134] Improved code based on comments 2012-01-17 11:25:25 +01:00
Fabien Potencier
e8f9a55012 fixed CS 2012-01-17 11:23:46 +01:00
Fabien Potencier
9c3c53a5c1 merged 2.0 2012-01-17 11:23:18 +01:00
Fabien Potencier
51ecb3c07b fixed CS 2012-01-17 10:56:02 +01:00
Fabien Potencier
3c3d202255 fixed typo 2012-01-17 10:52:45 +01:00
Manuel Reinhard
90abc0f454 [Serializer][XmlEncoder] add CDATA padding only if necessary
Changed XML encoder so CDATA padding is only added to value if necessary.
2012-01-17 10:51:09 +01:00
Henrik Bjørnskov
959614b4ca Use reflection to determaine the correct path for component validation.xml file 2012-01-17 10:37:10 +01:00
Hugo Hamon
0c1832450d [HttpKernel] added extra information when collecting data from an object if that object implements a __toString(). 2012-01-17 09:22:00 +01:00
Fabien Potencier
733ac9de7a [HttpFoundation] fixed exception message (closes #3123) 2012-01-16 22:09:07 +01:00
Fabien Potencier
33170ae572 merged branch ManuelKiessling/ticket_3090_bugfix (PR #3127)
Commits
-------

7e14a56 [Locale] Removed unneccesary semi-colon
cacc880 [Bugfix][Locale] Fixed incomplete Locale data loading

Discussion
----------

[Bugfix][Locale] Fixed incomplete Locale data loading

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: ![Build Status](https://secure.travis-ci.org/ManuelKiessling/symfony.png) Fixes the following tickets: #3090
Todo: -

Sublocales like de_CH returned only incomplete results for
getDisplayCountries(), getDisplayLanguages() and getDisplayLocales(),
consisting only of results specific for this sublocale, but without the
results of their respective parent locale

This PR was https://github.com/symfony/symfony/pull/3106 before - reopened it as a new PR because the commits were too chaotic.
2012-01-16 21:58:33 +01:00
Fabien Potencier
e056480ab2 merged branch bschussek/collection-validator (PR #3118)
Commits
-------

e6e3da5 [Validator] Improved test coverage of CollectionValidator and reduced test code duplication
509c7bf [Validator] Moved Optional and Required constraints to dedicated sub namespace.
bf59018 [Validator] Removed @api-tag from Optional and Required constraint, since these two are new.
6641f3e [Validator] Added constraints Optional and Required for the CollectionValidator

Discussion
----------

[Validator] Improve support for optional/required fields in Collection constraint

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

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=collection-validator)

Improves the `Collection` constraint to test on a more granular level if entries of the collection are optional or required. Before this could only be set using the "allowExtraFields" and "allowMissingFields" options, but these are very general and limited.

The former syntax - without Optional or Required - is still supported.

Usage:

    $array = array(
        'name' => 'Bernhard',
        'birthdate' => '1970-01-01',
    );
    $validator->validate($array, null, new Collection(array(
        'name' => new Required(),
        'birthdate' => new Optional(),
    ));

    // you can also pass additional constraints for the fields
    $validator->validate($array, null, new Collection(array(
        'name' => new Required(array(
            new Type('string'),
            new MinLength(3),
        )),
        'birthdate' => new Optional(new Date()),
    ));

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

by canni at 2012-01-15T20:22:17Z

@bschussek I've rewritten a lot of test code for Collection validator in 2.0 branch and also had modified validator itself, as it had a bug #3078, consider waiting with this PR till fabpot will merge 2.0 back into master, as there will be code conflicts :)

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

by Koc at 2012-01-15T23:13:04Z

Does it helps to #2615 ?

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

by fabpot at 2012-01-16T06:44:53Z

@canni: I've just merged 2.0 into master.

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

by bschussek at 2012-01-16T12:05:19Z

@fabpot: Rebased. I also fixed the CS issues mentioned by @stof.
2012-01-16 21:56:42 +01:00
Fabien Potencier
277b78149d merged branch gimler/encoder_fix (PR #3122)
Commits
-------

f3c413d add missing class var; add phpdocs

Discussion
----------

add missing class var; add phpdocs

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

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

by fabpot at 2012-01-16T11:12:27Z

We don't document properties, especially private ones.

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

by vicb at 2012-01-16T11:20:44Z

Good doc always help and should be accepted even for private properties.

However sometimes doc isn't necessary: `The digest algorithm to use` does not bring more information than the name itself `MessageDigestPasswordEncoder::algorithm`, the `@var`  annotation could be useful - even more for objects & arrays.

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

by gimler at 2012-01-16T11:37:54Z

i have remove the private property comments.
2012-01-16 21:52:05 +01:00
Bernhard Schussek
0c70a410e5 [Form] Made validation of form children configurable. Set the option "cascade_validation" to true if you need it. 2012-01-16 20:49:43 +01:00
Manuel Kiessling
7e14a56392 [Locale] Removed unneccesary semi-colon 2012-01-16 19:25:01 +01:00
Manuel Kiessling
cacc880929 [Bugfix][Locale] Fixed incomplete Locale data loading
Sublocales like de_CH returned only incomplete results for
getDisplayCountries(), getDisplayLanguages() and getDisplayLocales(),
consisting only of results specific for this sublocale, but without the
results of their respective parent locale
2012-01-16 17:25:42 +01:00
Toni Uebernickel
360f5745cb fix expected return type of MutableAclProvider 2012-01-16 15:24:43 +01:00
Gordon Franke
f3c413d156 add missing class var; add phpdocs 2012-01-16 12:15:36 +01:00
Bernhard Schussek
509c7bfb5b [Validator] Moved Optional and Required constraints to dedicated sub namespace. 2012-01-16 11:30:56 +01:00
Bernhard Schussek
bf5901850a [Validator] Removed @api-tag from Optional and Required constraint, since these two are new. 2012-01-16 11:30:56 +01:00
Bernhard Schussek
6641f3e231 [Validator] Added constraints Optional and Required for the CollectionValidator 2012-01-16 11:30:56 +01:00
Fabien Potencier
efada56312 merged branch pulzarraider/czech_translations_update (PR #3120)
Commits
-------

f69116b czech translations update

Discussion
----------

[FrameworkBundle] Czech translations update

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-01-16 07:46:22 +01:00
Fabien Potencier
5fa0f2d92b merged 2.0 2012-01-16 07:44:08 +01:00
Fabien Potencier
33f68fe821 added a missing use statement 2012-01-16 07:42:19 +01:00
Andrej Hudec
f69116b700 czech translations update 2012-01-16 00:48:18 +01:00
Sebastian Hörl
dd12ff836d CS fix, getConstraints renamed 2012-01-15 13:11:15 +01:00
Sebastian Hörl
09c191136a [Validator] Improved dynamic constraints 2012-01-14 02:24:14 +01:00
Sebastian Hörl
54cb6e458e [Validator] Added dynamic constraints 2012-01-14 02:06:07 +01:00
Fabien Potencier
119a24f016 merged branch makasim/yaml-throw-not-readable (PR #3105)
Commits
-------

7961014 [Yaml][Parser] changes according review
efce640 [Yaml][Parser] throw an exception if not readable

Discussion
----------

[Yaml][Parser] throw an exception if service file not readable.

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

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

by makasim at 2012-01-13T15:49:49Z

 @fabpot done
2012-01-13 22:27:28 +01:00
Kris Wallsmith
d67d419f3c [HttpFoundation] added missing trustProxy condition 2012-01-13 11:05:57 -08:00
Maksim Kotlyar
7961014140 [Yaml][Parser] changes according review 2012-01-13 17:48:38 +02:00
Maksim Kotlyar
efce640a5e [Yaml][Parser] throw an exception if not readable 2012-01-13 10:48:50 +02: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
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
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
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
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
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
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