Commit Graph

9229 Commits

Author SHA1 Message Date
Jean-François Simon
bd1d28cb50 [Console] Added formatter style stack tests. 2012-04-11 07:58:28 +02:00
Jean-François Simon
b63bd0e7e0 [Console] Added formatter style stack. 2012-04-11 07:58:13 +02:00
Fabien Potencier
02e1b81f65 merged 2.0 2012-04-10 20:26:56 +02:00
Fabien Potencier
57990cc53f merged branch johannes85/2.0 (PR #3791)
Commits
-------

0024ddc Fix for using route name as check_path.

Discussion
----------

Security Bundle route as check_path

In the current 2.0 branch you can't use a route as
firewalls:
admin_area:
login_path:
you will get a InvalidConfigurationException.

In the 2.1 version this is fixed. Since 2.1 isn't released i think this fix should be merged into the 2.0 branch too. Many people have this problem (https://github.com/schmittjoh/JMSI18nRoutingBundle/issues/7) for example which effectively blocks internationalisation in combination with the firewall.

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

by stof at 2012-04-10T13:35:13Z

@fabpot ping
2012-04-10 20:26:31 +02:00
Fabien Potencier
c7b226442b merged branch bschussek/issue3732 (PR #3819)
Commits
-------

c4e68a3 [Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class

Discussion
----------

[Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class

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

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

The addXxx()/removeXxx() methods should now be called correctly in ChoiceType and CollectionType.

PropertyPath now favors addXxx()/removeXxx() over setXxx() for collections. For example:

```
$propertyPath = new PropertyPath('article.tags');

// Tries to use addTag()/removeTag() and only uses setTags() (et al.)
// if not found
$propertyPath->setValue($article, $tags);
```

For other languages than English or very irregular plurals, a custom singular can be set by separating it with a pipe:

```
$propertyPath = new PropertyPath('article.genera|genus');
```

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

by bschussek at 2012-04-07T12:40:39Z

Again, the failing build is not my fault.
2012-04-10 20:22:54 +02:00
Fabien Potencier
517f8e0162 merged branch bschussek/issue3839 (PR #3859)
Commits
-------

61d792e [Form] Changed checkboxes in an expanded multiple-choice field to not include the choice index
bc9bc4a [Form] Fixed behavior of expanded multiple-choice field when submitted without ticks
2e07256 [Form] Simplified choice list API
2645120 [Form] Fixed handling of expanded choice lists, checkboxes and radio buttons with empty values ("")

Discussion
----------

[Form] Fixed handling of empty values in checkbox/radio/choice type

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

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

This PR fixes the processing of checkboxes and radio buttons with empty "value" attributes as well as of expanded choice forms with empty values. Additionally, some unnecessary complexity has been removed of the new ChoiceList API.

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

by stof at 2012-04-10T13:56:12Z

You probably need to change some things in the CHANGELOG file too

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

by bschussek at 2012-04-10T14:39:24Z

No. This is an update of a previous post-2.0 PR, the CHANGELOG is still accurate.

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

by stof at 2012-04-10T14:46:47Z

well, doesn't it require changes to the description of previous changes related to the ChoiceList ? It does in the UPGRADE file so it is weird if the CHANGELOG does not require any change.

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

by bschussek at 2012-04-10T14:56:05Z

Feel free to check yourself :)
2012-04-10 20:02:12 +02:00
Fabien Potencier
48abdaff3c merged branch bschussek/issue3278 (PR #3860)
Commits
-------

004c873 [Form] Fixed display of DateTimeType and TimeType when displayed as "single_text" and "with_seconds" is false

Discussion
----------

[Form] Fixed display of [Date]TimeType when displayed as "single_text" and "with_seconds" is false

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

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3278)
2012-04-10 19:55:43 +02:00
Fabien Potencier
837960f3c4 merged branch yethee/sync_ru_trans (PR #3863)
Commits
-------

362ac78 [FrameworkBundle] Sync Russian translations

Discussion
----------

[FrameworkBundle] Sync Russian translations
2012-04-10 19:54:15 +02:00
Deni
362ac78463 [FrameworkBundle] Sync Russian translations 2012-04-10 21:33:35 +04:00
Bernhard Schussek
004c873c74 [Form] Fixed display of DateTimeType and TimeType when displayed as "single_text" and "with_seconds" is false 2012-04-10 18:15:31 +02:00
Bernhard Schussek
61d792eebd [Form] Changed checkboxes in an expanded multiple-choice field to not include the choice index 2012-04-10 17:47:40 +02:00
Bernhard Schussek
bc9bc4af5d [Form] Fixed behavior of expanded multiple-choice field when submitted without ticks 2012-04-10 17:42:05 +02:00
Victor Berchet
77185e0998 [Routing] Allow spaces in the script name for the apache dumper 2012-04-10 17:29:43 +02:00
Victor Berchet
6465a6987a [Routing] Fixes to handle spaces in route pattern
- The route compiler does not add extra space or line-feed,
- The generated regex does not use the 'x' modified any more,
- The PHP and apache matchers do not need to strip any chars (vs space and line feed before),
- The space characters are escaped according to the apache format
2012-04-10 17:29:34 +02:00
Bernhard Schussek
2e07256921 [Form] Simplified choice list API 2012-04-10 15:37:24 +02:00
Bernhard Schussek
26451201e0 [Form] Fixed handling of expanded choice lists, checkboxes and radio buttons with empty values ("") 2012-04-10 15:35:46 +02:00
Fabien Potencier
07e261ea9e removed obsolete files 2012-04-10 11:50:32 +02:00
Fabien Potencier
667f8fd474 merged branch brikou/typehint_fix (PR #3853)
Commits
-------

6486e25 fixed used statements
3530858 fixed typehints in docblocks (IDE completion works now)

Discussion
----------

Typehint fix

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

by fabpot at 2012-04-10T09:12:51Z

For type hint in PHPDoc, we are using the class name and not the full namespace (of course, we need the associated use statement).

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

by brikou at 2012-04-10T09:29:39Z

@fabpot ok fabien, i've added the use statements and (for both entityRepository and manager) cheer
2012-04-10 11:43:16 +02:00
Brikou CARRE
6486e25a38 fixed used statements 2012-04-10 11:28:30 +02:00
Fabien Potencier
a8cfa4a7de merged branch pminnieur/patch-2 (PR #3852)
Commits
-------

a56bea6 removed `param_converter` from symfony-1.0.xsd

Discussion
----------

removed `param_converter` from symfony-1.0.xsd

I think its a relict of the SensioFrameworkExtraBundle?
2012-04-10 11:13:14 +02:00
Brikou CARRE
353085857b fixed typehints in docblocks (IDE completion works now) 2012-04-10 11:04:07 +02:00
Pierre Minnieur
a56bea6d88 removed param_converter from symfony-1.0.xsd 2012-04-10 12:00:57 +03:00
Fabien Potencier
8860424823 merged branch vicb/url_decoding (PR #3780)
Commits
-------

55014a6 [Routing] Request methods always return a raw path, fix the matcher to decode only once
d17ba0e Fixed base URL detection when request URI contains encoded chars

Discussion
----------

[RFC] Fix issues with url decoding

Related: #2324, #2963, #2962, #2579

### This PR fixes two issues:

* `+` in paths were turned to " " by `urldecode()`
* `urldecode()` was called a few times (and a different number of times according to which part of the path was handled, see #2962 for details).

### BC Breaks:

* `Request::getPathInfo()`, `Request::getBaseUrl()` and `Request::getBasePath` now return the raw (encoded) path (vs a decoded path before this PR). You should check any calls to these methods in your code and wrap them in `rawurldecode()` if needed.
* The `UrlMatcher` now decodes the URL only once (i.e. variable are no more decoded twice) and use `rawurldecode()` to support `+`.

### Notes:

* @arnaud-lb, the first commit is based on your #2963 so I put your name for the commit,

### Comment history from the original PR:

@vicb

**The state before this PR:**

* getRequestUri() returns an **encoded** value
* getPathInfo() returns a **decoded** value
* getBaseUrl() returns a **decoded** value
* getBasePath() returns a **decoded** value

The decoded value is wrong as `urldecode` is used in place of `rawurldecode` turning `+` into a space character (#2324).

The matcher starts by urldecoing the path (it is already decoded as explained right before) and then urldecodes each variable one more time.

We end up with a path being decoded twice and variables being decoded three times.

`Request::getUri()` calls both `getBaseUrl()` and `getPathInfo()` so that the return URI is **decoded**.

**The state after the PR:**

* getRequestUri() returns an **encoded** value
* getPathInfo() returns an **encoded** value
* getBaseUrl() returns an **encoded** value
* getBasePath() returns an **encoded** value

We are consistent and we have the raw values everywhere - there is no (easy) way to get the encoded value back once it has been decoded as it is done in the current code.

The matcher relies on an encoded value and decode the value only once (using `rawurldecode` to support `+`s).

So basically this PR:

* fix a bug - URL with `+` are now supported,
* makes paths consistent - encoded values everywhere, including `getUri()`
* makes variables consistent: they are decoded only once - the same as query string parameters.

There are some BC breaks:

* getPathInfo() returns an encoded value vs a decoded one before,
* getBaseUrl() returns an encoded value vs a decoded one before.
* getBasePath() returns an encoded value vs a decoded one before.

Any code relying on the output of one of the 2 previous methods should be checked and upgraded if needed. I am interested in the use cases where your code need to be updated.

@Seldaek

I checked a few projects and this is what I found (usage of getPathInfo & getBaseUrl):

- One use case of getPathInfo to check if the url started with `/something/` which is a prefix used for all "overlay" content which had to be treated differently somewhere => most likely unaffected
- One use case for checking path prefixes by regex in our [CorsBundle](https://github.com/nelmio/NelmioCorsBundle/blob/master/EventListener/CorsListener.php#L52-56) => potentially affected depending on the complexity of regexes I'd say

@vicb

Thanks @Seldaek for reporting the use cases. You second case would be solved by `rawurldecode`ing the path info which is a minimal change.

And in general I think we have to expand to doc to specify the url format that should be used.

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

by vicb at 2012-04-04T13:42:21Z

I'll squash the commits before this gets merged but for now it make the review easier.
2012-04-10 10:43:27 +02:00
Victor Berchet
55014a6841 [Routing] Request methods always return a raw path, fix the matcher to decode only once
sq
2012-04-10 10:40:58 +02:00
Fabien Potencier
2a16f84ce5 merged branch alessandro1997/issue-3848 (PR #3849)
Commits
-------

78d6f3f [Filesystem] Written missing tests.
1998f3f [Filesystem] Added silence operator to rename().
7ce5a52 [Filesystem] Fixed docs for rename().
3f2865b [Filesystem] rename() throws RuntimeException on error (fixes #3848).

Discussion
----------

[Filesystem] rename() throws RuntimeException on error.

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

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

by alessandro1997 at 2012-04-09T19:32:23Z

I have a doubt: I can't write any tests since the rename() function generates a warning if an error occurs. Should I use the silence operator or what else?

Maybe @stof could enlighten me?
2012-04-10 10:27:05 +02:00
Arnaud Le Blanc
d17ba0e147 Fixed base URL detection when request URI contains encoded chars
Signed-off-by: Victor Berchet <victor@suumit.com>
2012-04-10 10:15:43 +02:00
Alessandro Desantis
78d6f3f0e0 [Filesystem] Written missing tests. 2012-04-10 10:15:30 +02:00
Alessandro Desantis
1998f3f5ec [Filesystem] Added silence operator to rename(). 2012-04-10 10:15:18 +02:00
Alessandro Desantis
7ce5a526ec [Filesystem] Fixed docs for rename(). 2012-04-09 21:19:37 +02:00
Alessandro Desantis
3f2865b90f [Filesystem] rename() throws RuntimeException on error (fixes #3848). 2012-04-09 20:56:50 +02:00
Jakub Zalas
efad5d5452 [Filesystem] Prevented infiite loop on windows while calling mirror on symlink. Added test for mirroring symlinks. 2012-04-09 15:14:36 +01:00
Fabien Potencier
d8652785cf merged branch eriksencosta/locale (PR #3840)
Commits
-------

31dde14 [Locale] updated StubIntlDateFormatter::format() behavior for PHP >= 5.3.4

Discussion
----------

[Locale] updated StubIntlDateFormatter::format() behavior for PHP >= 5.3.4

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

[![Build Status](https://secure.travis-ci.org/eriksencosta/symfony.png?branch=locale)](http://travis-ci.org/eriksencosta/symfony)

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

by drak at 2012-04-08T23:20:20Z

This looks like a feature addition as opposed to a bug fix and if so, should probably go in the master branch rather than 2.0.

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

by stof at 2012-04-08T23:30:25Z

@drak it is a bug fix as the stub is meant to have the same behavior than the real intl

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

by drak at 2012-04-08T23:36:08Z

ok, thanks for the clarification, I wasnt sure.

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

by eriksencosta at 2012-04-08T23:44:22Z

@stof is right. I myself fixed it in master and then remembered that bug fixes should be made in 2.0.
2012-04-09 15:05:51 +02:00
Kim Hemsø Rasmussen
c36651bb6e Fixed spelling error 2012-04-09 10:21:42 +02:00
Eriksen Costa
31dde144ff [Locale] updated StubIntlDateFormatter::format() behavior for PHP >= 5.3.4 2012-04-08 19:21:28 -03:00
Fabien Potencier
127cff0aa8 merged branch Seldaek/process_fix (PR #3838)
Commits
-------

6dca141 [Process] Skip signal assertion on windows
4cd0fb4 [Process] Skip test that is still getting stuck on windows
e82a05d [Process] Close pipes before calling proc_close to avoid deadlocks as advised on the proc_close php.net documentation
f4227b5 [Process] Removing useless code (this is already done in updateStatus)
2d586d2 [Process] Fix a mistake triggering stream_select errors

Discussion
----------

Process fixes

A few fixes, including making the tests pass on windows and fixing composer/composer#543. Given the sensitivity of this code I did a bunch of very granular commits explaining everything.
2012-04-08 20:44:36 +02:00
Jordi Boggiano
6dca141de8 [Process] Skip signal assertion on windows 2012-04-08 20:29:02 +02:00
Jordi Boggiano
4cd0fb4c69 [Process] Skip test that is still getting stuck on windows 2012-04-08 20:28:28 +02:00
Jordi Boggiano
e82a05d3e7 [Process] Close pipes before calling proc_close to avoid deadlocks as advised on the proc_close php.net documentation 2012-04-08 20:27:37 +02:00
Jordi Boggiano
f4227b5f82 [Process] Removing useless code (this is already done in updateStatus) 2012-04-08 20:26:27 +02:00
Jordi Boggiano
2d586d245d [Process] Fix a mistake triggering stream_select errors 2012-04-08 20:26:04 +02:00
Fabien Potencier
da0eaa63cc merged branch Seldaek/at_op (PR #3837)
Commits
-------

f3408cc [Finder] Avoid unnecessary use of the @ operator

Discussion
----------

[Finder] Avoid unnecessary use of the @ operator

Tests are passing

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

by stof at 2012-04-08T17:42:01Z

Does PHP really throw an exception on failure or is it only the case when an error handler converts a warning to an exception ? It would be weird given the small amount of cases where PHP uses exceptions.

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

by Seldaek at 2012-04-08T17:43:51Z

```
$ php -r 'new DateTime("foo");'

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (foo) at
position 0 (f): The timezone could not be found in the database' in Command line code on line 1
```

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

by Seldaek at 2012-04-08T17:45:09Z

In a constructor it's pretty hard to return false, so it has to throw an exception. The php.net docs also say it so I'm fairly sure it's nothing specific to my setup.
2012-04-08 20:00:30 +02:00
Jordi Boggiano
f3408ccf2c [Finder] Avoid unnecessary use of the @ operator 2012-04-08 19:39:04 +02:00
Fabien Potencier
27c41f1e8e merged branch stloyd/crawler_phpdoc (PR #3834)
Commits
-------

292364a [DomCrawler] Added some docbocks into DomCrawler classes. Closes #3832

Discussion
----------

[DomCrawler] Added some docbocks into DomCrawler classes, reordered func...

...tions to follow Symfony 2 CS. Closes #3832

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

by fabpot at 2012-04-08T10:38:39Z

Can you revert the code move as it makes merges between 2.0 and master much more complex. Thanks.

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

by stloyd at 2012-04-08T11:36:53Z

Reverted and changed commit message.

@fabpot Should I make PR for `master` according to CS ?

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

by stof at 2012-04-08T11:40:58Z

@stloyd this can be considered as a bugfix as you are fixing the phpdoc. So 2.0 is fine
2012-04-08 14:03:25 +02:00
Joseph Bielawski
292364ad70 [DomCrawler] Added some docbocks into DomCrawler classes. Closes #3832 2012-04-08 13:35:35 +02:00
Fabien Potencier
d6948581ac [TwigBundle] simplified code 2012-04-08 12:56:21 +02:00
Fabien Potencier
a11ec3e71c [TwigBundle] added correct file name in twig:lint exception reporting 2012-04-08 12:53:40 +02:00
Fabien Potencier
57c6aaa397 [TwigBundle] tweaked previous merge 2012-04-08 12:41:50 +02:00
Fabien Potencier
9c0fba93b2 merged branch marcw/feat-twig-lint (PR #3804)
Commits
-------

8726ade Adds more features to twig:lint command
1d7e9d9 Adds a linter command for templates

Discussion
----------

Adds a linter command for templates

Let's this PR be stoffed. ;)

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

by Tobion at 2012-04-06T15:48:18Z

Checking a single file is very limited. Checking a whole directory would be more useful, wouldn't it?

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

by willdurand at 2012-04-06T17:56:57Z

I think you should provide a way to validate all templates for a given bundle, something like:

    php app/console twig:lint @MySuperBundle

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

by henrikbjorn at 2012-04-06T18:03:45Z

Wouldnt it be better to throw some kind of exception if the lint is erroneous?

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

by marcw at 2012-04-07T11:22:34Z

@Tobion @willdurand  You can do that by combining unix tools.
@henrikbjorn Why ?

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

by marcw at 2012-04-07T11:27:11Z

Updated.

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

by dlsniper at 2012-04-07T13:15:53Z

@marcw it would be indeed nice to have support for a bundle/directory out of the box as some of the Symfony2 users might not be running unix or know the right commands to make this work.

I could help you with a PR in your repo if you want.

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

by henrikbjorn at 2012-04-07T18:55:34Z

@marcw as the console component will catch them and convert them into the right error code, also will display what went wrong instead of just dieing.

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

by marcw at 2012-04-08T09:15:37Z

Updated with all comments and requested features.
2012-04-08 12:39:25 +02:00
Bernhard Schussek
c4e68a3295 [Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class
Setting a property path like "article.tags" will now automatically try to
favor addTag() and removeTag() over setTags(), if found. If you want to
set up a property path with an irregular singular that is not detected,
you can use "|" to separate the plural from the singular form in the
path: "article.genera|genus".

Another consequence of this commit is that the MergeCollectionListener has
been simplified a lot. Forms returning an array or a collection will
always result in adders/removers being called now without having to add
this listener.
2012-04-08 12:32:17 +02:00
Bernhard Schussek
65aa387da0 [Form] Fixed index generation in EntityChoiceList if ID is not an integer 2012-04-08 12:32:10 +02:00