Commit Graph

35503 Commits

Author SHA1 Message Date
Christian Flothmann
1a1aaa74d6 Revert "bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)"
This reverts commit f1f18ad608, reversing
changes made to 8e8ee09747.
2018-01-20 13:12:25 +01:00
Fabien Potencier
aae79986a8 Merge branch '2.8' into 3.3
* 2.8:
  [Validator] Conflict with egulias/email-validator 2.0
2018-01-20 11:54:14 +01:00
Fabien Potencier
420789c694 Merge branch '2.7' into 2.8
* 2.7:
  [Validator] Conflict with egulias/email-validator 2.0
2018-01-20 11:50:52 +01:00
Fabien Potencier
f1f18ad608 bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)
This PR was merged into the 2.7 branch.

Discussion
----------

[Validator] Conflict with egulias/email-validator 2.0

| Q             | A
| ------------- | ---
| Branch?       | 2.7 (and 2.8)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

For code that uses `EmailValidator` with strict email checking using `egulias/email-validator` and that aims to support both Symfony 2.8 LTS and Symfony 3.4/4.0, it is impossible to have a working set of dependencies with Symfony 2.7/Symfony 2.8 if one wishes to use `egulias/email-validator: ^1.2|^2.1`.

This is because Composer happily installs `egulias/email-validator` latest 2.1.x which is not compatible with Symfony 2.8.

This would prevent installation of v2.1.x on Symfony 2.7/2.8.

Commits
-------

72d8e8adb0 [Validator] Conflict with egulias/email-validator 2.0
2018-01-20 11:43:40 +01:00
Nicolas Grekas
ad8aff4203 [DI] compilation perf tweak 2018-01-20 09:34:19 +01:00
Edi Modrić
72d8e8adb0 [Validator] Conflict with egulias/email-validator 2.0 2018-01-20 00:08:53 +01:00
Fabien Potencier
2aa54b8cbd feature #25493 [Serializer] default_constructor_arguments context option for denormalization (Nek-)
This PR was squashed before being merged into the 4.1-dev branch (closes #25493).

Discussion
----------

[Serializer] `default_constructor_arguments` context option for denormalization

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | (there is no RFC for this)
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/8914

## Problems

In the case you want to deserialize value-objects, if all the data required by its constructor are **not** given as input, the serializer will throw a simple `RuntimeException` exception. This makes impossible to catch it. (as current fix on my projects I use exception message to be sure to catch the good one X.x")

The second problem is a missing feature to fill the required object with an empty one. This needs to be defined by the user because the serializer can't guess how to build it.

Here is a project that exposes the problem of the current behavior. https://github.com/Nek-/api-platform-value-object

## Solutions suggested

I suggest a solution in 2 parts because the second part is more touchy.

1. Replace the current exception by a new specific one
2. Add a new `empty_data` option to the context of deserialization so you can specify data for objects impossible to instantiate, this is great because the serializer no more throw exception and the validator can then work as expected and send violations to the user. This solution is inspired by forms solutions to fix the issue with value objects

Here is what you can do with this feature:
```php
class DummyValueObject
{
    public function __construct($foo, $bar) { $this->foo = $foo; $this->bar = $bar; }
}

$empty = new DummyValueObject('', '');
$result = $normalizer->denormalize(['foo' => 'Hello'], DummyValueObject::class, 'json', [
    'empty_data' => [
        DummyValueObject::class => $empty,
    ],
]);

// It's impossible to construct a DummyValueObject with only "foo" value. So the serializer
// will replace it with the given empty data
```

There are 2 commits so I can quickly provide you only the first point if you want. Hope you'll like this.

## Solution after discussion

1. New exception `MissingConstructorArgumentsException`
2. New context option `default_constructor_arguments`

```php
class DummyValueObject
{
    public function __construct($foo, $bar) { $this->foo = $foo; $this->bar = $bar; }
}

$result = $normalizer->denormalize(['foo' => 'Hello'], DummyValueObject::class, 'json', [
    'default_constructor_arguments' => [
        DummyValueObject::class => ['foo' => '', 'bar' => ''],
    ],
]);

// DummyValueObject is contructed with the given `foo` and empty `bar`
```

Commits
-------

1523a85542 [Serializer]  context option for denormalization
2018-01-19 13:05:43 +01:00
Maxime Veber
1523a85542 [Serializer] context option for denormalization 2018-01-19 13:05:41 +01:00
Fabien Potencier
fe3e2c3adc feature #25839 [SecurityBundle] Deprecate in_memory.user abstract service (chalasr)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[SecurityBundle] Deprecate in_memory.user abstract service

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/25837#discussion_r162358386
| License       | MIT
| Doc PR        | n/a

Commits
-------

75a4117b66 [SecurityBundle] Deprecate in_memory.user abstract service
2018-01-19 12:59:28 +01:00
Amrouche Hamza
bcb79a39ef
[Validator] add missing parent isset and add test 2018-01-19 12:39:28 +01:00
Robin Chalas
75a4117b66 [SecurityBundle] Deprecate in_memory.user abstract service 2018-01-19 12:36:48 +01:00
Robin Chalas
9b0e73715b Merge branch '4.0'
* 4.0:
  [Serializer] fix undefined class
  [FrameworkBundle] fix DI extension tests
2018-01-19 12:32:05 +01:00
Robin Chalas
3d011e0e37 Merge branch '3.4' into 4.0
* 3.4:
  [Serializer] fix undefined class
  [FrameworkBundle] fix DI extension tests
2018-01-19 12:28:59 +01:00
Robin Chalas
d2a316f0db minor #25846 [Serializer] Fix undefined class (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] Fix undefined class

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

bad merge

Commits
-------

bc7b5d2 [Serializer] fix undefined class
2018-01-19 12:28:17 +01:00
Robin Chalas
bc7b5d2943 [Serializer] fix undefined class 2018-01-19 12:19:37 +01:00
Robin Chalas
f5d2d67508 Merge branch '3.3' into 3.4
* 3.3:
  [FrameworkBundle] fix DI extension tests
2018-01-19 12:19:01 +01:00
Robin Chalas
38abc7bb8f minor #25847 [FrameworkBundle] fix DI extension tests (xabbuh)
This PR was merged into the 3.3 branch.

Discussion
----------

[FrameworkBundle] fix DI extension tests

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

The failing tests relied on the assets integration being enabled. Since
we never did enable this explicitly, the assets related definitions are
removed now that #25789 was merged which fixed #25760.

Commits
-------

1cb8f69 [FrameworkBundle] fix DI extension tests
2018-01-19 12:17:11 +01:00
Christian Flothmann
1cb8f6918f [FrameworkBundle] fix DI extension tests
The failing tests relied on the assets integration being enabled. Since
we never did enable this explicitly, the assets related definitions are
removed now that #25789 was merged which fixed #25760.
2018-01-19 12:05:40 +01:00
Robin Chalas
86a7dede86 Merge branch '4.0'
* 4.0:
  fix merge
2018-01-19 11:07:49 +01:00
Robin Chalas
77465e3495 Merge branch '3.4' into 4.0
* 3.4:
  fix merge
2018-01-19 11:07:28 +01:00
Robin Chalas
39557e25c4 fix merge 2018-01-19 11:06:48 +01:00
Robin Chalas
1b1ed670a6 Merge branch '3.3' into 3.4
* 3.3:
  [SecurityBundle] Don't register in memory users as services
2018-01-19 11:03:45 +01:00
Robin Chalas
2c6e23cb3e Merge branch '4.0'
* 4.0:
  Fix translation test
  [SecurityBundle] Don't register in memory users as services
2018-01-19 10:39:33 +01:00
Robin Chalas
6cab776316 Fix translation test 2018-01-19 10:38:27 +01:00
Robin Chalas
34a3e25c1f Merge branch '3.3' into 4.0
* 3.3:
  [SecurityBundle] Don't register in memory users as services
2018-01-19 10:33:46 +01:00
Robin Chalas
00621d4840 Merge branch '2.8' into 3.3
* 2.8:
  [SecurityBundle] Don't register in memory users as services
2018-01-19 10:28:48 +01:00
Robin Chalas
e64cb185cb Merge branch '2.7' into 2.8
* 2.7:
  [SecurityBundle] Don't register in memory users as services
2018-01-19 10:21:47 +01:00
Fabien Potencier
a8d179bf66 fixed CS 2018-01-19 08:24:33 +01:00
Fabien Potencier
0a56a37953 feature #24392 Display orphaned events in profiler (kejwmen)
This PR was squashed before being merged into the 4.1-dev branch (closes #24392).

Discussion
----------

Display orphaned events in profiler

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

Implements #24347.

Deprecating `TraceableEventDispatcherInterface`.

Commits
-------

509f9a9233 Display orphaned events in profiler
2018-01-19 08:23:48 +01:00
Mateusz Sip
509f9a9233 Display orphaned events in profiler 2018-01-19 08:23:12 +01:00
Fabien Potencier
d6c05ccfe7 feature #25275 [DI] Allow for invokable event listeners (ro0NL)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[DI] Allow for invokable event listeners

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Inspired by #24637 / #25259. This adds invokable support for event listeners :)

```yaml
Some\Foo:
    tags: [{ name: kernel.event_listener, event: kernel.request }]
```

```php
class Foo {
    public function __invoke(GetResponseEvent $event) { }
}
```

Commits
-------

fa5b7eb95b [DI] Allow for invokable event listeners
2018-01-19 08:19:03 +01:00
Fabien Potencier
d94fbcef46 feature #25627 [DI] Add a simple CSV env var processor (dunglas)
This PR was squashed before being merged into the 4.1-dev branch (closes #25627).

Discussion
----------

[DI] Add a simple CSV env var processor

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Add a new environment variable processor to parse the very popular comma separated array format like `foo,bar`. As it uses the `str_getcsv`, it also support escaping and enclosure.

I'm not sure about the name, maybe `array` or `simple_array` would be better.

Commits
-------

d730209d87 [DI] Add a simple CSV env var processor
2018-01-19 08:16:51 +01:00
Kévin Dunglas
d730209d87 [DI] Add a simple CSV env var processor 2018-01-19 08:16:49 +01:00
Fabien Potencier
8e8ee09747 bug #25837 [SecurityBundle] Don't register in memory users as services (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

[SecurityBundle] Don't register in memory users as services

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

Commits
-------

13fa0454e4 [SecurityBundle] Don't register in memory users as services
2018-01-19 08:04:55 +01:00
Nicolas Grekas
32cd453196 Merge branch '4.0'
* 4.0:
  [HttpKernel] DebugHandlersListener should always replace the existing exception handler
  fix the Composer API being used
  [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used
  [Debug] Always decorate existing exception handlers to deal with fatal errors
  Enableable ArrayNodeDefinition is disabled for empty configuration
  Fixing a bug where the dump() function depended on bundle ordering
  [Cache] Fix handling of apcu_fetch() edgy behavior
  Add nn (Norwegian Nynorsk) translation files, and improve existing file
  Problem in phar see mergerequest #25579
  [Form] Disallow transform dates beyond the year 9999
  Avoid button label translation when it's set to false
  Copied NO language files to the new NB locale.
  [Serializer] DateTimeNormalizer handling of null and empty values (returning null or empty instead of new object)
  Fix options resolver with array allowed types
  [Console] Improve phpdoc on StyleInterface::ask()
  [TwigBridge][WIP] Pass the form-check-inline in parent
2018-01-18 23:19:50 +01:00
Nicolas Grekas
dd32dabd19 Merge branch '3.4' into 4.0
* 3.4:
  [HttpKernel] DebugHandlersListener should always replace the existing exception handler
  fix the Composer API being used
  [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used
  [Debug] Always decorate existing exception handlers to deal with fatal errors
  Enableable ArrayNodeDefinition is disabled for empty configuration
  Fixing a bug where the dump() function depended on bundle ordering
  [Cache] Fix handling of apcu_fetch() edgy behavior
  Add nn (Norwegian Nynorsk) translation files, and improve existing file
  Problem in phar see mergerequest #25579
  [Form] Disallow transform dates beyond the year 9999
  Avoid button label translation when it's set to false
  Copied NO language files to the new NB locale.
  [Serializer] DateTimeNormalizer handling of null and empty values (returning null or empty instead of new object)
  Fix options resolver with array allowed types
  [Console] Improve phpdoc on StyleInterface::ask()
  [TwigBridge][WIP] Pass the form-check-inline in parent
2018-01-18 23:19:33 +01:00
Nicolas Grekas
5f75d43e42 Merge branch '3.3' into 3.4
* 3.3:
  [HttpKernel] DebugHandlersListener should always replace the existing exception handler
  fix the Composer API being used
  [Debug] Always decorate existing exception handlers to deal with fatal errors
  Enableable ArrayNodeDefinition is disabled for empty configuration
  Fixing a bug where the dump() function depended on bundle ordering
  [Cache] Fix handling of apcu_fetch() edgy behavior
  Add nn (Norwegian Nynorsk) translation files, and improve existing file
  Problem in phar see mergerequest #25579
  [Form] Disallow transform dates beyond the year 9999
  Copied NO language files to the new NB locale.
  [Serializer] DateTimeNormalizer handling of null and empty values (returning null or empty instead of new object)
  [Console] Improve phpdoc on StyleInterface::ask()
2018-01-18 23:16:57 +01:00
Nicolas Grekas
5d9996457b Merge branch '2.8' into 3.3
* 2.8:
  [HttpKernel] DebugHandlersListener should always replace the existing exception handler
2018-01-18 23:16:35 +01:00
Nicolas Grekas
7fc3969cd6 Merge branch '2.7' into 2.8
* 2.7:
  [HttpKernel] DebugHandlersListener should always replace the existing exception handler
2018-01-18 23:12:33 +01:00
Nicolas Grekas
b785f133af bug #25835 [HttpKernel] DebugHandlersListener should always replace the existing exception handler (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] DebugHandlersListener should always replace the existing exception handler

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

The current logic is inconsistent because replacing or not depends whether an ExceptionHandler is registered or not.
Embeds tests for the previous PR on the same topic, Debug component's side.

Commits
-------

a4ddcc2 [HttpKernel] DebugHandlersListener should always replace the existing exception handler
2018-01-18 23:10:51 +01:00
Nicolas Grekas
a4ddcc298d [HttpKernel] DebugHandlersListener should always replace the existing exception handler 2018-01-18 23:01:50 +01:00
Nicolas Grekas
5f535581b9 [HttpKernel] Make session-related services extra-lazy 2018-01-18 18:12:09 +01:00
Robin Chalas
13fa0454e4 [SecurityBundle] Don't register in memory users as services 2018-01-18 15:57:23 +01:00
Christian Flothmann
753197f09e Merge branch '2.8' into 3.3
* 2.8:
  fix the Composer API being used
  [Debug] Always decorate existing exception handlers to deal with fatal errors
  Enableable ArrayNodeDefinition is disabled for empty configuration
  Fixing a bug where the dump() function depended on bundle ordering
  Add nn (Norwegian Nynorsk) translation files, and improve existing file
  Problem in phar see mergerequest #25579
  [Form] Disallow transform dates beyond the year 9999
  Copied NO language files to the new NB locale.
  [Console] Improve phpdoc on StyleInterface::ask()
2018-01-18 15:19:00 +01:00
Christian Flothmann
48872f3aed Merge branch '2.7' into 2.8
* 2.7:
  fix the Composer API being used
  [Debug] Always decorate existing exception handlers to deal with fatal errors
  Enableable ArrayNodeDefinition is disabled for empty configuration
  Fixing a bug where the dump() function depended on bundle ordering
  Add nn (Norwegian Nynorsk) translation files, and improve existing file
  Problem in phar see mergerequest #25579
  [Form] Disallow transform dates beyond the year 9999
  Copied NO language files to the new NB locale.
  [Console] Improve phpdoc on StyleInterface::ask()
2018-01-18 14:56:23 +01:00
Robin Chalas
6e6ac9eaee feature #25092 [Security] #25091 add target user to SwitchUserListener (jwmickey)
This PR was squashed before being merged into the 4.1-dev branch (closes #25092).

Discussion
----------

[Security] #25091 add target user to SwitchUserListener

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

This patch provides the target user to the SwitchUserListener's
accessDecisionManager->decide() call as the $object parameter to
give any registered voters extra information.

Commits
-------

5cb6f2a [Security] #25091 add target user to SwitchUserListener
2018-01-18 13:34:40 +01:00
Jody Mickey
5cb6f2abf4 [Security] #25091 add target user to SwitchUserListener 2018-01-18 13:34:36 +01:00
Fabien Potencier
78a8a63450 bug #25829 [Debug] Always decorate existing exception handlers to deal with fatal errors (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Debug] Always decorate existing exception handlers to deal with fatal errors

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

Decorating the exception is seamless, let's always do it and fix handling of fatal errors.
Related to #25408 also.

Commits
-------

205d7ae3f7 [Debug] Always decorate existing exception handlers to deal with fatal errors
2018-01-18 13:12:09 +01:00
Fabien Potencier
67e38797a6 bug #25823 [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage is used (giovannialbero1992)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Notify that symfony/expression-language is not installed if ExpressionLanguage is used

| Q             | A
| ------------- | ---
| Branch?       | master for features / 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25742
| License       | MIT
| Doc PR        | not requested

Commits
-------

6aa2b7cce0 [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used
2018-01-18 13:02:00 +01:00
Fabien Potencier
5d39415e3d minor #25833 fix the Composer API being used (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

fix the Composer API being used

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

Commits
-------

a986efef0a fix the Composer API being used
2018-01-18 13:00:41 +01:00