Commit Graph

7532 Commits

Author SHA1 Message Date
Jordan Alliot
e83e00a7b8 Fixed rendering of FileType (value is not a valid attribute for input[type=file]) 2011-11-11 11:01:38 +01:00
ondrowan
2582fcb1e1 Added tests for string fix in DateTimeToArrayTransformer (8351a11286). 2011-11-11 10:00:41 +01:00
ondrowan
8351a11286 Added check for array fields to be integers in reverseTransform method. This prevents checkdate from getting strings as arguments and throwing incorrect ErrorException when submitting form with malformed (string) data in, for example, Date field. #2609 2011-11-11 09:58:40 +01:00
Fabien Potencier
6b0e7c8c41 [Translation] removed unneeded methods 2011-11-11 09:02:31 +01:00
Fabien Potencier
db6fea9fd0 merged branch drak/eventdispatcher_opimization (PR #2597)
Commits
-------

0fe8ac6 [EventDispatcher] Removed unused argument.

Discussion
----------

[EventDispatcher] Removed unused parameter in doDispatch().

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

Removed unused parameter.

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

by Seldaek at 2011/11/10 02:30:01 -0800

A simple $foo($arg) is faster than call_user_func, fine, but with all the if/else logic here are you sure it is still faster?

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

by drak at 2011/11/10 06:44:41 -0800

call_user_func is inordinately slow, I'll make some benchmarks. The if logic here is pretty, two conditionals for array callables or one conditional for closures/functions.

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

by drak at 2011/11/10 12:45:27 -0800

After doing some benchmarks, there are savings to be made in all cases except when the listener is an instantiated object when it's marginally slower, so I've reverted these changes and made this PR just to remove the unused argument in `doDispatch()`. You can see the benchmark code here: https://gist.github.com/1356129.

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

by drak at 2011/11/10 12:46:55 -0800

This PR is ready for consideration.
2011-11-11 08:31:28 +01:00
Fabien Potencier
45b218e7c4 [Translation] added detection for circular references when adding a fallback catalogue 2011-11-11 08:29:16 +01:00
Fabien Potencier
632a99fd7c merged branch stealth35/fix_2599 (PR #2601)
Commits
-------

a245e15 [DomCrawler] trim URI in getURI

Discussion
----------

[DomCrawler] trim URI in getURI

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2599
2011-11-11 08:09:10 +01:00
Drak
0fe8ac6149 [EventDispatcher] Removed unused argument. 2011-11-11 02:25:05 +05:45
stealth35
a245e15434 [DomCrawler] trim URI in getURI 2011-11-10 15:38:28 +01:00
Grégoire Paris
5b30812b26 See this issue : https://github.com/symfony/symfony/issues/2433 2011-11-10 15:38:07 +01:00
Fabien Potencier
f8164ec380 merged branch aboks/yaml_inlinetest (PR #2602)
Commits
-------

e7acb23 [Yaml][Tests] Fixed missing locale string for Windows platforms which caused test to fail

Discussion
----------

[Yaml][Tests] Fixed missing locale string for Windows platforms

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

On Windows all the locale formats supplied in the test do not work, causing the test to fail. The added locale string works correctly on (at least) Windows 7.
2011-11-10 13:05:03 +01:00
Arnout Boks
e7acb23636 [Yaml][Tests] Fixed missing locale string for Windows platforms which caused test to fail 2011-11-10 12:50:53 +01:00
Fabien Potencier
47b09f791b merged branch snc/issue-1798-sf21 (PR #2598)
Commits
-------

4d80ebd Remove security token if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).

Discussion
----------

[2.1] Fix for issue 1798

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

This is a simplified PR of #2528 for the master branch.
2011-11-10 10:55:51 +01:00
Fabien Potencier
0025673d15 Merge branch '2.0'
* 2.0:
  Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589).
  Remove only the security token instead of the session cookie.
  Clear session cookie if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).
2011-11-10 10:55:16 +01:00
Fabien Potencier
3c584f5683 merged branch snc/issue-1798 (PR #2528)
Commits
-------

f9befb6 Remove only the security token instead of the session cookie.
348bccb Clear session cookie if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).

Discussion
----------

Fix for issue 1798

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

Clear session cookie if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798).

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

by snc at 2011/11/01 04:01:49 -0700

@stof I have changed the code so that it only removes the token... do we still need any hook support?

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

by stof at 2011/11/01 04:07:17 -0700

well, the hook is for your own use case but it would be for 2.1 only anyway, not for 2.0

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

by snc at 2011/11/07 15:11:52 -0800

Now that #2414 is merged to 2.1, this could be simplified for the master branch...
2011-11-10 10:54:32 +01:00
Fabien Potencier
877e484529 merged branch snc/issue-2589 (PR #2596)
Commits
-------

932c144 Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589).

Discussion
----------

Fix for issue 2589

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

Added a class to the logs ol element to prevent hiding it when toggling an exception.
2011-11-10 10:52:13 +01:00
H. Westphal
4d80ebd5c8 Remove security token if user was deleted, is disabled or locked to prevent infinite redirect loops to the login path (fixes #1798). 2011-11-10 10:34:33 +01:00
H. Westphal
932c144534 Added a class to the logs ol element to prevent hiding it when toggling an exception (fixes #2589). 2011-11-10 10:20:28 +01:00
Fabien Potencier
5882a98d52 merged branch stealth35/gettext_dumper (PR #2590)
Commits
-------

56cb7a5 [Translation] add gettext PO and MO Dumper

Discussion
----------

[Translation] add gettext PO and MO Dumper

See #2412

    Bug fix: no
    Feature addition: yes
    Backwards compatibility break: no
    Symfony2 tests pass: yes
    Fixes the following tickets: -
2011-11-10 07:50:55 +01:00
stealth35
56cb7a515b [Translation] add gettext PO and MO Dumper 2011-11-10 00:24:31 +01:00
Fabien Potencier
2d53751e13 merged branch thomasbibb/master (PR #2559)
Commits
-------

269a5e6 Added the ablity to get a requests ContentType

Discussion
----------

Added getContentType

I've added the ability for Symfony\Component\HttpFoundation\Request to return the ContentType from serverBag this uses the $formats array to determine if the requested ContentType is valid.

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

by ericclemmons at 2011/11/03 20:00:51 -0700

Have you considered squashing a couple of your commits?  They seem doubled up.

Trivial, I know, but it will make each commit stand on its own (instead of appearing as a typo correction)

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

by thomasbibb at 2011/11/04 02:02:36 -0700

done.

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

by ericclemmons at 2011/11/04 07:25:20 -0700

You may need to do a `git push -f origin master`.  Check the commits tab to see the duplicate history:

> https://github.com/symfony/symfony/pull/2559/commits

Wheeeee, rebasing is fun!

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

by thomasbibb at 2011/11/04 12:26:06 -0700

There we got thats better :)

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

by ericclemmons at 2011/11/04 12:55:07 -0700

👍  Now let's see if it gets approved by @fabpot :)

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

by thomasbibb at 2011/11/06 03:39:12 -0800

I've removed the space between the method name and the parenthesis.

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

by thomasbibb at 2011/11/06 04:05:15 -0800

done.

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

by fabpot at 2011/11/06 23:44:22 -0800

Can you added some unit tests?
2011-11-09 22:08:42 +01:00
Fabien Potencier
56f7626632 updated CHANGELOG for 2.1 2011-11-09 22:02:31 +01:00
Fabien Potencier
8ca8aef151 merged branch stof/gettext_loader (PR #2412)
Commits
-------

d974a4a Merge pull request #4 from stealth35/test_mo_loader
cf05646 delete useless tests
19f9de9 [Translation] fix gettext tests
965f2bf Merge pull request #3 from stealth35/test_mo_loader
9c2a26d [Translation] add Mo loader tests
9af2342 [Translation] Added the gettext loaders

Discussion
----------

[Translation] Added the gettext loaders

This is the squashed version of the work done by @xaav in #634.

@stealth35 you said you will work on the dumpers. do you have some stuff on it ?

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

by drak at 2011/10/24 19:28:43 -0700

Is there any more progress with this?

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

by stealth35 at 2011/10/25 00:57:19 -0700

I work on the dumpers, but the Po loader is wrong, caus' the Po ressource can be multiline,

     msgid ""
     "Here is an example of how one might continue a very long string\n"
     "for the common case the string represents multi-line output.\n"

http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files

Anyway the Po format is an intermediate format to Mo file, (like .txt to .res file for ICU), IMO we can just support the real gettext format : Mo

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

by stealth35 at 2011/11/03 02:00:24 -0700

@stof The MO Dumper is ready (stealth35/symfony@f2d1d5b4de), should we keep the PO format ?

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

by fabpot at 2011/11/07 08:50:59 -0800

@stealth35: The PO is what people will use for their translations. They will then dump it to MO. So, we need both PO and MO loaders and dumpers.

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

by stealth35 at 2011/11/08 01:25:39 -0800

@fabpot, I'm ready for both dumpers, you can merge this, and I'll open a PR for the dumpers

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

by fabpot at 2011/11/08 22:37:47 -0800

I've just had a look at this PR code again and I see that the unit tests are pretty slim. Is it possible to add some tests for the mo loader?

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

by stealth35 at 2011/11/09 01:15:25 -0800

@fabpot test send to @stof ✌️

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

by stof at 2011/11/09 02:22:55 -0800

and merged in this branch

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

by fabpot at 2011/11/09 02:39:09 -0800

The tests do not pass for me:

    There was 1 error:

    1) Symfony\Tests\Component\Translation\Loader\MoFileLoaderTest::testLoadDoesNothingIfEmpty
    InvalidArgumentException: MO stream content has an invalid format.

    /Users/fabien/work/symfony/git/symfony/src/Symfony/Component/Translation/Loader/MoFileLoader.php:79
    /Users/fabien/work/symfony/git/symfony/src/Symfony/Component/Translation/Loader/MoFileLoader.php:46
    /Users/fabien/work/symfony/git/symfony/tests/Symfony/Tests/Component/Translation/Loader/MoFileLoaderTest.php:34

    --

    There was 1 failure:

    1) Symfony\Tests\Component\Translation\Loader\PoFileLoaderTest::testLoad
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
     Array (
    -    'foo' => 'bar'
     )

    /Users/fabien/work/symfony/git/symfony/tests/Symfony/Tests/Component/Translation/Loader/PoFileLoaderTest.php:25
2011-11-09 22:00:02 +01:00
Fabien Potencier
ad6ffea225 updated CHANGELOG for 2.1 2011-11-09 21:55:11 +01:00
Fabien Potencier
df88070e76 merged branch stealth35/patch-14 (PR #2581)
Commits
-------

796c6b2 [Locale] add getIcuVersion and getIcuDataVersion to Locale

Discussion
----------

[Locale] add getIcuVersion and getIcuDataVersion to Locale

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

by stealth35 at 2011/11/09 00:51:30 -0800

@stof thank for your review
2011-11-09 21:53:59 +01:00
Christophe Coevoet
d974a4a465 Merge pull request #4 from stealth35/test_mo_loader
[Translation] fix gettext tests
2011-11-09 03:13:48 -08:00
stealth35
cf05646cc7 delete useless tests 2011-11-09 12:11:16 +01:00
stealth35
19f9de9e8f [Translation] fix gettext tests 2011-11-09 12:08:40 +01:00
Christophe Coevoet
965f2bf4d2 Merge pull request #3 from stealth35/test_mo_loader
[Translation] add Mo loader tests
2011-11-09 02:22:12 -08:00
stealth35
9c2a26db12 [Translation] add Mo loader tests 2011-11-09 10:13:06 +01:00
stealth35
796c6b2f8d [Locale] add getIcuVersion and getIcuDataVersion to Locale 2011-11-09 09:50:22 +01:00
Fabien Potencier
c3fc52ef82 merged branch mrtorrent/patch-1 (PR #2582)
Commits
-------

0e7540b Fix typo in changelog

Discussion
----------

Fix typo in changelog

Minor typo fix
2011-11-08 23:03:52 +01:00
Miquel Rodríguez Telep
0e7540b080 Fix typo in changelog 2011-11-08 18:00:05 +00:00
Fabien Potencier
679bf5320a updated CHANGELOG for 2.1 2011-11-08 09:06:23 +01:00
Fabien Potencier
4f3e7bb698 merged branch canni/enable_validation_groups_callback (PR #2498)
Commits
-------

d08ec5e Add DelegatingValidator tests
e1822e7 Enable dynamic set of validation groups by a callback or Closure

Discussion
----------

[Form][Validator] Enable dynamic set of validation groups based on callback

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Symfony2 tests written for new feature: yes
closes tickets: #2498 #1151

This will allow developer to pass a Closure or a callback array as a Validation groups option of a form. Eg:

```
class ClientType extends AbstarctType
{
// ...
    public function getDefaultOptions(array $options)
    {
        return array(
            'validation_groups' => function(FormInterface $form){
                // return array of validation groups based on submitted user data (data is after transform)
                $data = $form->getData();
                if($data->getType() == Entity\Client::TYPE_PERSON)
                    return array('Default', 'person');
                else
                    return array('Default', 'company');
            },
        );
    }
// ...
}
```

```
class ClientType extends AbstarctType
{
// ...
    public function getDefaultOptions(array $options)
    {
        return array(
            'validation_groups' => array(
                'Acme\\AcmeBundle\\Entity\\Client',
                'determineValidationGroups'
            ),
        );
    }
// ...
}
```

This will make developers life easier !

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

by schmittjoh at 2011/10/27 06:39:56 -0700

Does that work if your ClientType were added to another form type?

e.g.

```php
<?php

class MyComplexType extends AbstractType
{
    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder->add('client', new ClientType());
    }

    // ...
}
```

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

by canni at 2011/10/27 06:44:33 -0700

This is doing nothing more than injecting array of validation groups, should work, but I have not tested this use case.

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

by canni at 2011/10/28 01:58:26 -0700

PHPUnit output

```
OK, but incomplete or skipped tests!
Tests: 5011, Assertions: 12356, Incomplete: 36, Skipped: 32.
```

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

by canni at 2011/11/02 11:37:47 -0700

Now functionality is complete, test are written, and implementation is clean. :)

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

by stloyd at 2011/11/02 11:50:44 -0700

Can tou `squash` your commits ? Thanks.

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

by canni at 2011/11/02 11:58:41 -0700

Done

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

by fabpot at 2011/11/07 07:51:18 -0800

Can you add some tests for the `DelegatingValidator` class, which is where we can ensure that the new feature actually works as expected?

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

by canni at 2011/11/07 13:53:16 -0800

OK, I've written proof-of-concept tests, also I've squashed few commits to make things clear.
Personally I think this should go straight into 2.0 series, as it do not beak BC, and a feature is really nice to use.

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

by stof at 2011/11/07 14:17:15 -0800

@canni the 2.0 branch is for bug fixes, not for new features. This is the difference between maintenance releases and minor releases.
2011-11-08 09:05:41 +01:00
Fabien Potencier
88718164bf merged branch dbu/fix-routing-exception-doc (PR #2566)
Commits
-------

57040a8 document exceptions on the interfaces, inheritDoc on implementations, use statements instead of fully qualified exception names

Discussion
----------

Fix routing exception doc

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

This is only documentation cleanup for the url matcher and generator interfaces as they did not properly reflect the exceptions that are expected to be thrown. when the exceptions are not respected, unexpected behaviour can happen.

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

by dbu at 2011/11/07 00:49:08 -0800

ok, changed that. thought in an interface definition we would not want to "use" exceptions just for doc, but its changed now.

i rebased on the upstream master and got this additional commit about portuguese translations, no idea why this happened. and my local git diff does not show it either. is it creating problems in the pull request or can you still merge?

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

by fabpot at 2011/11/07 01:11:31 -0800

@dbu: Can you squash your commits and remove a commit that is not related to this PR? Thanks a lot.

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

by dbu at 2011/11/07 23:49:37 -0800

ok, done. thanks to you, i learn a lot about git :-)

for the record: i did git rebase --soft  on the commit id before my first commit, then git reset HEAD and git checkout on all the files not related to my changes, then commit again with the consolidated message, then git push --force origin fix-routing-exception-doc
2011-11-08 09:01:25 +01:00
dbu
57040a8703 document exceptions on the interfaces, inheritDoc on implementations, use statements instead of fully qualified exception names 2011-11-08 08:47:17 +01:00
Fabien Potencier
290734353c merged 2.0 2011-11-08 08:38:14 +01:00
Fabien Potencier
9d2ab9ca9c [Doctrine] fixed security user reloading when the user has been changed via a form with validation errors (closes #2033) 2011-11-08 08:33:49 +01:00
Fabien Potencier
414d4be7e8 [Doctrine] refactored unit tests 2011-11-08 08:23:31 +01:00
Fabien Potencier
318576b3ac merged branch ericclemmons/2295-serializer-normalizable-traversable (PR #2578)
Commits
-------

7346896 Changed Serialized#supportsNormalization to PRIVATE
e851efc Updated SerializerTest with "normalizeTraversable" & "testNormalizeGivesPriorityToInterfaceOverTraversable"
d789f94 Serializer#normalize gives precedence to objects that support normalization
9e6ba9a Added protected Serializer#supportsNormalization

Discussion
----------

[Serializer] `normalize` should use supported normalizer before Traversable

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (discussion needed)
Symfony2 tests pass: yes
Fixes the following tickets: #2295

**Same as PR #2539, except rebased onto `2.0`**

Should I abstract out a `supportsDenormalization` function just for symmetry?
2011-11-08 07:46:27 +01:00
Fabien Potencier
023a10ca3b merged branch jmikola/2.0-HttpUtils (PR #2576)
Commits
-------

57b7daf [Security] Fix checkRequestPath doc; closes #2323

Discussion
----------

[Security] Fix checkRequestPath doc; closes #2323
2011-11-08 07:41:05 +01:00
Eric Clemmons
7346896129 Changed Serialized#supportsNormalization to PRIVATE 2011-11-07 19:25:58 -08:00
Eric Clemmons
e851efc8d6 Updated SerializerTest with "normalizeTraversable" & "testNormalizeGivesPriorityToInterfaceOverTraversable" 2011-11-07 19:25:58 -08:00
Eric Clemmons
d789f9424e Serializer#normalize gives precedence to objects that support normalization 2011-11-07 19:25:58 -08:00
Eric Clemmons
9e6ba9ae89 Added protected Serializer#supportsNormalization
This is very useful for cleaning up the logic in Serializer#normalize
and allow easy checking of both the cache & stored normalizers
2011-11-07 19:25:58 -08:00
Jeremy Mikola
57b7daf252 [Security] Fix checkRequestPath doc; closes #2323 2011-11-07 17:36:10 -05:00
Fabien Potencier
a594840c47 updated CHANGELOG for 2.1 2011-11-07 23:28:28 +01:00
Fabien Potencier
8d9ea7c1ce merged branch dpb587/patch-sectok (PR #2414)
Commits
-------

ab9caa0 [Security] Check for request's session before attempting writes.
dabff0e [Security] Support removing tokens from a session.

Discussion
----------

[Security] Support removing tokens from a session.

Currently there is no way to remove a session's security token without invalidating the entire session and all its data (the ContextListener will only update the session if a token is non-null and non-anonymous). This patch fixes that.

I consider this a bug and I found no tests to prove otherwise. Let me know if I'm mistaken. Originally mentioned at https://groups.google.com/d/topic/symfony-devs/ojLvh0WUbfo/discussion

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

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

by ms937 at 2011/10/24 05:19:21 -0700

This change looks good to me. In fact I'm using similar patch in my app and it works as intended. Also, several other people requested this on the mailing list. Could someone from Symfony team merge this? Thanks.
2011-11-07 23:19:37 +01:00
Dariusz Górecki
d08ec5e55f Add DelegatingValidator tests 2011-11-07 22:48:01 +01:00