Commit Graph

15102 Commits

Author SHA1 Message Date
Fabien Potencier 1602746548 merged branch fabpot/tests-simplification (PR #8796)
This PR was merged into the master branch.

Discussion
----------

removed deps checks in unit tests

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

As Composer is now widely used in the PHP world, having to run composer install before running the test suite is expected. This also has the nice benefit of removing a bunch of code, making things easier to maintain (there is only one place to declare a dev dependency), and probably more.

see fabpot/Silex#626 where we did the same a while ago for Silex.

Commits
-------

de50621 removed deps checks in unit tests
2013-08-23 17:27:50 +02:00
Bernhard Schussek 0951b8de16 [Translation] Fixed regression: When only one rule is passed to transChoice(), this rule should be used 2013-08-23 17:24:14 +02:00
Fabien Potencier 5a5a94c509 Merge branch '2.3'
* 2.3:
  [Routing] fix phpdoc
  [Form] Extracted ReferencingArrayIterator out of VirtualFormAwareIterator
  [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash.
  [Form] Added a test that ensures that setData() reacts to dynamic modifications of a form's children
  [Form] Removed exception in Button::setData(): setData() is now always called for all elements in the form tree during the initialization of the tree
  [Form] Removed call to deprecated method
  [Form] PropertyPathMapper::mapDataToForms() *always* calls setData() on every child to ensure that all *_DATA events were fired when the initialization phase is over (except for virtual forms)
  [Form] Removed superfluous reset() call
  [Form] Fixed: submit() reacts to dynamic modifications of the form children
2013-08-23 17:14:52 +02:00
Fabien Potencier 39f59b0fe9 Merge branch '2.2' into 2.3
* 2.2:
  [Routing] fix phpdoc
  [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash.
2013-08-23 17:14:07 +02:00
Fabien Potencier 6f5a163991 merged branch bschussek/form-submit-2.3 (PR #8828)
This PR was merged into the 2.3 branch.

Discussion
----------

[Form][2.3] Fixed Form::submit() and Form::setData() to react to dynamic form modifications

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

ref #3767, #3768, #4548, #8748
cc @Burgov

This PR ensures that fields that are added during the submission process of a form are submitted as well. For example:

```php
$builder = $this->createFormBuilder()
    ->add('country', 'choice', ...)
    ->getForm();

$builder->get('country')->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
    $form = $event->getForm()->getParent();
    $country = $event->getForm()->getData();

    $form->add('province', 'choice', /* ... something with $country ... */);
});
```

Currently, the field "province" will not be submitted, because the submission loop uses `foreach`, which ignores changes in the underyling array.

Contrary to #8827 (for 2.2), this PR also allows dynamic modifications during `setData()`:

```php
$builder = $this->createFormBuilder()
    ->add('country', 'choice', ...)
    ->getForm();

$builder->get('country')->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) {
    $form = $event->getForm()->getParent();
    $country = $event->getData();

    $form->add('province', 'choice', /* ... something with $country ... */);
});
```

For 2.2, this fix is not possible, because it would require changing the signature `DataMapperInterface::mapDataToForms($data, array $forms)` to `DataMapperInterface::mapDataToForms($data, array &$forms)`, which would be a BC break. For 2.3, this change is not necessary (instead of an array we now pass an iterator, which is passed by reference anyway).

Additionally, this PR ensures that `setData()` is called on *every* element of a form (except those inheriting their parent data) when `setData()` is called on the root element (i.e., during initialization). Currently, when some of the intermediate nodes (e.g. embedded forms) are submitted with an empty value, `setData()` won't be called on the nodes below (i.e. the fields of the embedded form) until `get*Data()` is called on them. If `getData()` is *not* called before `createView()`, any effects of `*_DATA` event listeners attached to those fields will not be visible in the view.

Commits
-------

7a34d96 Merge branch 'form-submit-2.2' into form-submit-2.3
cd27e1f [Form] Extracted ReferencingArrayIterator out of VirtualFormAwareIterator
3cb8a80 [Form] Added a test that ensures that setData() reacts to dynamic modifications of a form's children
07d14e5 [Form] Removed exception in Button::setData(): setData() is now always called for all elements in the form tree during the initialization of the tree
b9a3770 [Form] Removed call to deprecated method
878e27c Merge branch 'form-submit-2.2' into form-submit-2.3
ccaaedf [Form] PropertyPathMapper::mapDataToForms() *always* calls setData() on every child to ensure that all *_DATA events were fired when the initialization phase is over (except for virtual forms)
19b483f [Form] Removed superfluous reset() call
5d60a4f Merge branch 'form-submit-2.2' into form-submit-2.3
00bc270 [Form] Fixed: submit() reacts to dynamic modifications of the form children
2013-08-23 17:13:57 +02:00
Fabien Potencier 599aab424a merged branch bschussek/form-submit-2.2 (PR #8827)
This PR was merged into the 2.2 branch.

Discussion
----------

[Form][2.2] Fixed Form::submit() to react to dynamic form modifications

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

ref #3767, #3768, #4548, #8748
cc @Burgov

This PR ensures that fields that are added during the submission process of a form are submitted as well. For example:

```php
$builder = $this->createFormBuilder()
    ->add('country', 'choice', ...)
    ->getForm();

$builder->get('country')->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
    $form = $event->getForm()->getParent();
    $country = $event->getForm()->getData();

    $form->add('province', 'choice', /* ... something with $country ... */);
});
```

Currently, the field "province" will not be submitted, because the submission loop uses `foreach`, which ignores changes in the underyling array.

Additionally, this PR ensures that `setData()` is called on *every* element of a form (except those inheriting their parent data) when `setData()` is called on the root element (i.e., during initialization). Currently, when some of the intermediate nodes (e.g. embedded forms) are submitted with an empty value, `setData()` won't be called on the nodes below (i.e. the fields of the embedded form) until `get*Data()` is called on them. If `getData()` is *not* called before `createView()`, any effects of `*_DATA` event listeners attached to those fields will not be visible in the view.

Commits
-------

cd27e1f [Form] Extracted ReferencingArrayIterator out of VirtualFormAwareIterator
ccaaedf [Form] PropertyPathMapper::mapDataToForms() *always* calls setData() on every child to ensure that all *_DATA events were fired when the initialization phase is over (except for virtual forms)
19b483f [Form] Removed superfluous reset() call
00bc270 [Form] Fixed: submit() reacts to dynamic modifications of the form children
2013-08-23 17:11:03 +02:00
Tobias Schultze ee3cb88ec7 [Routing] fix phpdoc 2013-08-23 16:06:02 +02:00
Bernhard Schussek 7a34d96dcd Merge branch 'form-submit-2.2' into form-submit-2.3
Conflicts:
	src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
2013-08-23 13:18:39 +02:00
Bernhard Schussek cd27e1facb [Form] Extracted ReferencingArrayIterator out of VirtualFormAwareIterator 2013-08-23 13:16:42 +02:00
Fabien Potencier 228ecb96d0 merged branch oscherler/yaml-comment-colon-fix (PR #8824)
This PR was squashed before being merged into the 2.2 branch (closes #8824).

Discussion
----------

[Yaml] Fix comment containing a colon on a scalar line being parsed as a hash.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Note: I only ran the Yaml Component tests.

This PR fixes a bug in YAML parsing where a comment containing a colon followed by a space, like this:

    foo # warning: this is a scalar with a comment, not a hash

was parsed as a hash, resulting in:

    array( 'foo # warning' => 'this is a scalar with a comment, not a hash' )

instead of:

    'foo'

Commits
-------

4563f1b [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash.
2013-08-22 15:12:42 +02:00
Olivier 4563f1ba20 [Yaml] Fix comment containing a colon on a scalar line being parsed as a hash. 2013-08-22 15:12:42 +02:00
Fabien Potencier 7e87eb1fdf fixed request format when forwarding a request 2013-08-22 14:43:23 +02:00
Bernhard Schussek 3cb8a804f4 [Form] Added a test that ensures that setData() reacts to dynamic modifications of a form's children 2013-08-22 14:21:53 +02:00
Bernhard Schussek 07d14e5ff2 [Form] Removed exception in Button::setData(): setData() is now always called for all elements in the
form tree during the initialization of the tree
2013-08-22 14:19:04 +02:00
Bernhard Schussek b9a37703a6 [Form] Removed call to deprecated method 2013-08-22 14:18:47 +02:00
Bernhard Schussek 878e27cd99 Merge branch 'form-submit-2.2' into form-submit-2.3
Conflicts:
	src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
2013-08-22 14:12:19 +02:00
Bernhard Schussek ccaaedfcbb [Form] PropertyPathMapper::mapDataToForms() *always* calls setData() on every child to ensure
that all *_DATA events were fired when the initialization phase is over (except for virtual forms)
2013-08-22 14:10:15 +02:00
Bernhard Schussek 19b483f2ea [Form] Removed superfluous reset() call 2013-08-22 13:38:57 +02:00
Bernhard Schussek 5d60a4fa0a Merge branch 'form-submit-2.2' into form-submit-2.3
Conflicts:
	src/Symfony/Component/Form/Form.php
	src/Symfony/Component/Form/Tests/AbstractFormTest.php
	src/Symfony/Component/Form/Tests/CompoundFormTest.php
	src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
2013-08-22 13:28:18 +02:00
Bernhard Schussek 00bc2708bc [Form] Fixed: submit() reacts to dynamic modifications of the form children 2013-08-22 13:20:04 +02:00
Fabien Potencier 7117328bd7 [HttpKernel] added a comment to warn about possible inconsistencies 2013-08-22 09:01:15 +02:00
Fabien Potencier c4636e1252 added a functional test for locale handling in sub-requests 2013-08-22 08:57:44 +02:00
Charles Sarrazin 05fdb12ad9 Fixed issue #6932 - Inconsistent locale handling in subrequests
The fix consists in passing the locale in the controller reference,
inside the routablefragment renderer.
2013-08-22 08:57:23 +02:00
Fabien Potencier b3c31593c7 fixed locale of sub-requests when explicitely set by the developer (refs #8821) 2013-08-22 08:48:41 +02:00
Fabien Potencier 167245c9c7 Merge branch '2.3'
* 2.3:
  [Locale] fixed build-data exit code in case of an error
  fixed request format of sub-requests when explicitely set by the developer (closes #8787)
  Sets _format attribute only if it wasn't set previously by the user.
  Exclude little words of 'ee' to 'oo' plural transformation
  fixed the format of the request used to render an exception
  Fix typo in the check_path validator
  added a missing use statement (closes #8808)
  fix for Process:isSuccessful()
  Include untrusted host in the exception message

Conflicts:
	src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
	src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php
2013-08-22 08:44:20 +02:00
Fabien Potencier 8e1cb3e3ca Merge branch '2.2' into 2.3
* 2.2:
  [Locale] fixed build-data exit code in case of an error
  fixed request format of sub-requests when explicitely set by the developer (closes #8787)
  Sets _format attribute only if it wasn't set previously by the user.
  Exclude little words of 'ee' to 'oo' plural transformation
  fixed the format of the request used to render an exception
  Fix typo in the check_path validator
  added a missing use statement (closes #8808)
  fix for Process:isSuccessful()

Conflicts:
	UPGRADE-3.0.md
	src/Symfony/Component/Locale/Resources/data/build-data.php
2013-08-22 08:42:25 +02:00
Fabien Potencier 1ad64ee7a3 merged branch fabpot/inline-fragment-format (PR #8821)
This PR was merged into the 2.2 branch.

Discussion
----------

Sets _format attribute only if it wasn't set previously by the user

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8787, #8791
| License       | MIT
| Doc PR        |

Commits
-------

9bb7a3d fixed request format of sub-requests when explicitely set by the developer (closes #8787)
fa35597 Sets _format attribute only if it wasn't set previously by the user.
2013-08-22 08:30:26 +02:00
Fabien Potencier 8ab368d104 merged branch fabpot/exception-format (PR #8819)
This PR was merged into the 2.2 branch.

Discussion
----------

[HttpKernel] Fix request _format duplication for HttpKernel's ExceptionListener

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8777, #8778
| License       | MIT

This is a better fix for #8777.

Commits
-------

f946108 fixed the format of the request used to render an exception
2013-08-22 08:27:52 +02:00
Fabien Potencier b72bc0b257 [Locale] fixed build-data exit code in case of an error
When passing a message to the exit() function, PHP returns 0 instead of
an error code.
2013-08-22 08:25:58 +02:00
Fabien Potencier a5dc3b0829 merged branch hason/console (PR #8800)
This PR was merged into the master branch.

Discussion
----------

[Console] Improved searching commands

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I was very annoyed when I typed the command ``app/console a:d`` and I saw this exception ``The namespace "a" is ambiguous (assets, assetic)``. However, the shortcut ``a:d`` is unambiguous (``assets:install`` vs ``assetic:dump``).

Commits
-------

0beec8a [Console] Improved searching commands
2013-08-22 08:20:43 +02:00
Fabien Potencier 9bb7a3ddcb fixed request format of sub-requests when explicitely set by the developer (closes #8787) 2013-08-22 07:46:12 +02:00
David Marín fa35597755 Sets _format attribute only if it wasn't set previously by the user.
Fixes #8787
2013-08-22 07:45:36 +02:00
Fabien Potencier 124ad0dc69 merged branch sumbobyboys/patch-1 (PR #8804)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #8804).

Discussion
----------

Exclude little words of 'ee' to 'oo' plural transformation

The plural form of 'bee' and 'fee' are not 'foo' and 'boo'. In general words smaller than 3 letters doesn't change to a 'oo' form.

Commits
-------

0ffdb11 Exclude little words of 'ee' to 'oo' plural transformation
2013-08-22 06:15:06 +02:00
sumbobyboys 6453c1a018 Exclude little words of 'ee' to 'oo' plural transformation
The plural form of 'bee' and 'fee' are not 'foo' and 'boo'. In general words smaller than 3 letters doesn't change to a 'oo' form.
2013-08-22 06:15:06 +02:00
Fabien Potencier 0e14e1ddb7 [HttpFoundation] added constants for HTTP status code in Response 2013-08-22 06:10:30 +02:00
Fabien Potencier f946108d65 fixed the format of the request used to render an exception 2013-08-22 05:11:17 +02:00
Fabien Potencier 2872f839ad merged branch unkind/security-bundle-check-path-bugfix (PR #8782)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #8782).

Discussion
----------

[SecurityBundle] Fix typo in the check_path validator

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #3005, #2954
| License       | MIT

Actually, validator of `check_path` value is broken by #3005. It doesn't throw any exception even if `check_path` is an URI.

I've faced with wrong tests class hierarchy: `SecurityExtensionTest` is abstract test and I have to create the same test configuration for every format: PHP, XML, YAML. It looks like we test `Dependency Injection` and `Yaml` components. Issue with `check_path` does not depend on format, but such class hierarchy leaves me no choice. And I can't put test case into `ConfigurationTest`, because it doesn't know anything about security factories.

It looks like it's better to create new class for `SecurityExtension` tests.

Commits
-------

155dca0 [SecurityBundle] Fix typo in the check_path validator
2013-08-22 04:12:50 +02:00
Nikita Konstantinov 51022c30ae Fix typo in the check_path validator 2013-08-22 04:12:50 +02:00
Fabien Potencier 5f7219e2ab added a missing use statement (closes #8808) 2013-08-21 22:48:51 +02:00
Fabien Potencier cbc30a31e2 merged branch Seldaek/untrusted (PR #8810)
This PR was merged into the 2.3 branch.

Discussion
----------

Include untrusted host in the exception message

`Invalid *` error message without the actual value that triggered them are really unhelpful to debug issues.

Commits
-------

fd2f633 Include untrusted host in the exception message
2013-08-21 21:09:08 +02:00
Fabien Potencier 78e5f47849 merged branch tgabi333/2.2 (PR #8815)
This PR was merged into the 2.2 branch.

Discussion
----------

[Process] fix for Process:isSuccessful()

| Q             | A
| ------------- | ---
| Bug fix?      | [yes]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | []
| License       | MIT
| Doc PR        | []

This is a rebase of https://github.com/symfony/symfony/pull/8801

If you call isSuccessful() on a running process you would get true because of 0 == null. I think that is not the expected behavior and that is not what phpdoc @return block said so.

Commits
-------

262879d fix for Process:isSuccessful()
2013-08-21 17:32:30 +02:00
Tóth Gábor 262879d8b5 fix for Process:isSuccessful() 2013-08-21 16:50:47 +02:00
Jordi Boggiano fd2f63382a Include untrusted host in the exception message 2013-08-21 12:06:02 +02:00
Fabien Potencier 774b09cf56 Merge branch '2.3'
* 2.3:
  [Process] Use a consistent way to reset data of the process latest run
  CS fix
  [HttpFoundation] Fixed removing a nonexisting namespaced attribute.
  [Validation] Fixed IdentityTranslator to pass correct Locale to MessageSelector
  SwiftMailerHandler in Monolog bridge now able to react to kernel.terminate event

Conflicts:
	src/Symfony/Component/Process/Process.php
2013-08-21 09:59:24 +02:00
Fabien Potencier 4cfbdf11c3 Merge branch '2.2' into 2.3
* 2.2:
  [Process] Use a consistent way to reset data of the process latest run
  CS fix
  [HttpFoundation] Fixed removing a nonexisting namespaced attribute.
  [Validation] Fixed IdentityTranslator to pass correct Locale to MessageSelector
  SwiftMailerHandler in Monolog bridge now able to react to kernel.terminate event

Conflicts:
	src/Symfony/Component/Process/Process.php
2013-08-21 09:58:38 +02:00
Fabien Potencier 9c3c5d493f merged branch astina-forks/swiftmailer_handler (PR #8780)
This PR was merged into the 2.2 branch.

Discussion
----------

[MonologBridge] Allow SwiftMailerHandler to listen to kernel.terminate.event

This PR accompanies symfony/MonologBundle#51. Both are intended to fix symfony/symfony-standard#425.

MonologBundle configures SwiftMailerHandler as a Monolog handler and injects the proper transport service.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | 425
| License       | MIT
| Doc PR        | 2905

Commits
-------

62238b8 CS fix
c6ecd83 SwiftMailerHandler in Monolog bridge now able to react to kernel.terminate event
2013-08-21 09:57:29 +02:00
Fabien Potencier 36b5d19d9d merged branch romainneutron/properties-reset (PR #8806)
This PR was merged into the 2.2 branch.

Discussion
----------

[2.2][Process] Use a consistent way to reset data of the process latest run

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT

It is actually useful when cloning or running again a process.

Commits
-------

0723c10 [Process] Use a consistent way to reset data of the process latest run
2013-08-21 09:09:53 +02:00
Romain Neutron 0723c10239 [Process] Use a consistent way to reset data of the process latest run
It is actually useful when cloning or running again a process.
2013-08-20 20:43:40 +02:00
Martin Hasoň 0beec8a5aa [Console] Improved searching commands 2013-08-20 12:04:08 +02:00
Fabien Potencier de50621e8a removed deps checks in unit tests
As Composer is now widely used in the PHP world, having to run composer
install before running the test suite is expected. This also has the
nice benefit of removing a bunch of code, making things easier to
maintain (there is only one place to declare a dev dependency), and
probably more.
2013-08-19 22:44:22 +02:00