This PR was merged into the 4.0-dev branch.
Discussion
----------
Make internal constants private
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Changing some internal constants to private as suggested in https://github.com/symfony/symfony/pull/22862 (these are the only ones I found in the codebase)
Commits
-------
367b055 Make internal constants private
This PR was merged into the 3.3 branch.
Discussion
----------
[ProxyManager] Add FC layer
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | yes - minor
| Deprecations? | yes - made a class final
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This makes PRoxyDumper compatible with DumperInterface v4.0.
Technically, this is a BC break, but since I really don't expect anyone to extend ProxyDumper, I think we should do it - on 3.3 to close the gap as early as possible.
Commits
-------
4aeb6d8 [ProxyManager] Add FC layer
This PR was merged into the 3.2 branch.
Discussion
----------
[DI] Check for privates before shared services
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22801#discussion_r117732213, https://github.com/symfony/symfony/pull/22801#discussion_r117732599
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
cc @stof
Commits
-------
4f683a9a5b [DI] Check for privates before shared services
* 3.4:
[DI] prepare for signature change in 4.0
[DI] Add missing deprecation on Extension::getClassesToCompile
[Lock] Re-add the Lock component in 3.4
[Routing] remove an unused routing fixture
[Yaml] fix multiline block handling
[WebProfilerBundle] Fix sub-requests display in time profiler panel
[FrameworkBundle] Handle project dir in cache:clear command
[WebServerBundle] Mark ServerCommand as internal
[DI] Fix autowire error for inlined services
Close PHP code in phpt file
[Profiler][VarDumper] Fix searchbar css when in toolbar
Prevent auto-registration of UserPasswordEncoderCommand
[Process] Fixed incorrectly escaping arguments on Windows when inheritEnvironmentVariables is set to false
avoid double blanks while rendering form attributes
use getProjectDir() when possible
[PhpUnitBridge] add a changelog file
[FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator
* 3.3:
[DI] prepare for signature change in 4.0
[DI] Add missing deprecation on Extension::getClassesToCompile
[Routing] remove an unused routing fixture
[Yaml] fix multiline block handling
[WebProfilerBundle] Fix sub-requests display in time profiler panel
[FrameworkBundle] Handle project dir in cache:clear command
[WebServerBundle] Mark ServerCommand as internal
[DI] Fix autowire error for inlined services
Close PHP code in phpt file
[Profiler][VarDumper] Fix searchbar css when in toolbar
Prevent auto-registration of UserPasswordEncoderCommand
[Process] Fixed incorrectly escaping arguments on Windows when inheritEnvironmentVariables is set to false
avoid double blanks while rendering form attributes
use getProjectDir() when possible
[PhpUnitBridge] add a changelog file
[FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator
This PR was submitted for the 3.4 branch but it was merged into the 3.3 branch instead (closes#22818).
Discussion
----------
[DependencyInjection] prepare for signature change in 4.0
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
see failing tests in #22785
Commits
-------
c4b6e20 [DI] prepare for signature change in 4.0
This PR was merged into the 3.2 branch.
Discussion
----------
[Routing] remove an unused routing fixture
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This was initially removed in #13361 and accidentally added again
in #11394.
Commits
-------
6f67221129 [Routing] remove an unused routing fixture
This PR was squashed before being merged into the 3.4 branch (closes#22597).
Discussion
----------
[Lock] Re-add the Lock component in 3.4
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | #22580
| License | MIT
| Doc PR |
This PR reverts #22590 as decided in #22580.
Commits
-------
3b6c495c89 [Lock] Re-add the Lock component in 3.4
This PR was merged into the 3.3 branch.
Discussion
----------
[FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator
| Q | A
| ------------- | ---
| Branch? | 3.3 <!-- see comment below -->
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | yes <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22800#issuecomment-302865630 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Commits
-------
df747ce [FrameworkBundle][Validator] Deprecate passing validator instances/aliases over using the service locator
This PR was merged into the 3.3 branch.
Discussion
----------
[Form][3.3] avoid double blanks while rendering form attributes
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | kind of
| New feature? | no
| BC breaks? | no (rather reverts one)
| Deprecations? | no
| Tests pass? | we'll see
| Fixed tickets | --
| License | MIT
| Doc PR | --
This fix avoids the double blanks introduced by #20365 when using the Twig template. The `attributes` block already renders one blank before each attribute, so there's no need to add another one prior to calling the block.
Commits
-------
a9c11c9 avoid double blanks while rendering form attributes
This PR was squashed before being merged into the 3.3 branch (closes#22857).
Discussion
----------
[DI] Fix autowire error for inlined services
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22848
| License | MIT
| Doc PR | n/a
The `AutowirePass` defers autowiring exceptions until later so that we don't throw autowiring exceptions for services that are ultimately removed. But, if a service is *inlined*, then it appears to be removed, and so we don't throw the exception. This fixes that.
It's an easy fix - but it's a bit ugly. We're adding a bit more "state" to the passes... simply because there is some information that needs to be shared through the compiler process. There might be a better way of doing this in the future (e.g. storing some metadata on the `Compiler`), but this *does* work well.
Commits
-------
4bcef3d [DI] Fix autowire error for inlined services
This PR was merged into the 3.3 branch.
Discussion
----------
[SecurityBundle] Prevent auto-registration of UserPasswordEncoderCommand
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22855
| License | MIT
| Doc PR | n/a
Always registers the command as a service even if no encoders are configured so that it is not auto-registered via reflection.
Prevents an irrelevant deprecation when no encoders are configured and, if a day the per-convention command registration is removed, ensures that the command always exists (leading to an exception saying that you have no configured encoder, better than nothing).
ping @ogizanagi
Commits
-------
b39b35b Prevent auto-registration of UserPasswordEncoderCommand
This PR was merged into the 3.3 branch.
Discussion
----------
[Profiler][VarDumper] Fix searchbar css when in toolbar
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Because css is hard (`.sf-toolbarreset *` has precedence since 4acec8973f moved the `toolbar.css.twig` inclusion from up to bottom):
|Before|After|
|--|--|
|<img width="291" alt="screenshot 2017-05-22 a 19 36 06" src="https://cloud.githubusercontent.com/assets/2211145/26321182/208780c0-3f26-11e7-89bb-7aa64f17c7b5.PNG">|<img width="280" alt="screenshot 2017-05-22 a 19 36 27" src="https://cloud.githubusercontent.com/assets/2211145/26321188/248ed0ce-3f26-11e7-852a-40968fba2e9f.PNG">|
Commits
-------
98b3002 [Profiler][VarDumper] Fix searchbar css when in toolbar
This PR was merged into the 3.3 branch.
Discussion
----------
Close PHP code in phpt file
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes-ish
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | n/a
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
that's the only phpt file that is not closing php code section
this causes linting via `php -l` to fail
Commits
-------
36f6e05 Close PHP code in phpt file
This PR was merged into the 3.3 branch.
Discussion
----------
use getProjectDir() when possible
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | continues #22315
| License | MIT
| Doc PR |
Commits
-------
a8e298a66c use getProjectDir() when possible
This PR was merged into the 3.3 branch.
Discussion
----------
[Process] Fixed escaping arguments on Windows when inheritEnvironmentVariables is set to false
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets |
| License | MIT
| Doc PR |
I've added a FAILING testcase on Windows. It incorrectly substitutes an argument containing a quotation mark probably assuming it's an env var needed to backup when inheritEnvironmentVariables is set to false.
Commits
-------
26032ef [Process] Fixed incorrectly escaping arguments on Windows when inheritEnvironmentVariables is set to false
This PR was merged into the 4.0-dev branch.
Discussion
----------
[DI] Remove deprecated generating a dumped container without populating the method map
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| 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-->
See #20113
Commits
-------
fdb8c58 [DI] Remove deprecated generating a dumped container without populating the method map
This PR was merged into the 3.3 branch.
Discussion
----------
[FrameworkBundle][Translation] fix docblock position
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22822
| License | MIT
| Doc PR |
The `$defaultLocale` argument is present in the `Translator` class of
the FrameworkBundle, but is not part of the Translation component.
Commits
-------
0829964 fix docblock position
This PR was merged into the 3.3 branch.
Discussion
----------
[DI] Remove dead service_container checks
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| 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-->
Since #21627
Commits
-------
9a8ea93 [DI] Remove dead service_container checks
This PR was merged into the 4.0-dev branch.
Discussion
----------
[DI] Remove deprecated dumping an uncompiled container
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | should be
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
See #20634
Commits
-------
c1c525c [DI] Remove deprecated dumping an uncompiled container
This PR was merged into the 4.0-dev branch.
Discussion
----------
[PropertyInfo] Remove dead code with PHP 7+
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
b346e48 [PropertyInfo] Remove dead code with PHP 7+
This PR was squashed before being merged into the 4.0-dev branch (closes#22763).
Discussion
----------
[DI] Remove deprecated isFrozen()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | should be
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
See #19673
Test failure seems unrelated.
Commits
-------
04b39a3 [DI] Remove deprecated isFrozen()
This PR was merged into the 3.4 branch.
Discussion
----------
[FrameworkBundle] add forward compatibility layer for FrameworkBundle
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Commits
-------
9f14d06 [FrameworkBundle] add forward compatibility layer when using FrameworkBundle in version 3.4 with DependencyInjection component in version 4.0
* 3.4:
bug #22814 [FrameworkBundle] FC with EventDispatcher 4.0 (xabbuh)
[PhpUnitBridge] remove unused use statement
do not used deprecated validator test case class
do not mock a deprecated interface
[DI] Added missing deprecation in changelog
[Ldap] add a changelog file
[Security][Serializer][DI] Add new arguments typehints in preparation for 4.0
[MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows
[DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument
[DI][Serializer] Fix missing de(normalizer|coder) autoconfig
Use 0.0.0.0 as the server log host default.
* 3.3:
[PhpUnitBridge] remove unused use statement
do not mock a deprecated interface
[DI] Added missing deprecation in changelog
[Ldap] add a changelog file
[Security][Serializer][DI] Add new arguments typehints in preparation for 4.0
[MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows
[DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument
[DI][Serializer] Fix missing de(normalizer|coder) autoconfig
Use 0.0.0.0 as the server log host default.
This PR was merged into the 3.3 branch.
Discussion
----------
[Security][Serializer][DI] Add new arguments typehints in preparation for 4.0
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22743#pullrequestreview-38950305
| License | MIT
| Doc PR | N/A
See https://github.com/symfony/symfony/pull/22743#pullrequestreview-38950305 discussion for the motivations.
Commits
-------
b973b30 [Security][Serializer][DI] Add new arguments typehints in preparation for 4.0
This PR was merged into the 3.3 branch.
Discussion
----------
[DI][Serializer] Fix missing de(normalizer|coder) autoconfig
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes(ish)
| New feature? | no (at least complete the 3.3 feature)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Just migrating an app to `3.3.0-RC1`, I get surprised it wasn't already registered :)
Commits
-------
3c3a276 [DI][Serializer] Fix missing de(normalizer|coder) autoconfig
This PR was merged into the 3.3 branch.
Discussion
----------
[DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22780
| License | MIT
| Doc PR | N/A
According with https://github.com/symfony/symfony/issues/22780#issuecomment-302747395, when an `IteratorArgument` is empty, the closure generated by the `PhpDumper` should be `function () { return new EmptyIterator();` instead of `function () {}`, which is an invalid traversable for the `RewindableGenerator`.
Commits
-------
c2db0c1 [DependencyInjection] Fix dumping of RewindableGenerator with empty IteratorArgument
This PR was merged into the 4.0-dev branch.
Discussion
----------
[FrameworkBundle] FC with EventDispatcher 4.0
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22796#issuecomment-302875580
| License | MIT
| Doc PR |
Commits
-------
b7c76f7 [FrameworkBundle] FC with EventDispatcher 4.0
This PR was merged into the 3.2 branch.
Discussion
----------
[DI] Added missing deprecation in changelog
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| 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-->
See #20113
Commits
-------
b3d58c5 [DI] Added missing deprecation in changelog
This PR was merged into the 4.0-dev branch.
Discussion
----------
[FrameworkBundle] FC with EventDispatcher 4.0
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22796#issuecomment-302875580
| License | MIT
| Doc PR |
Commits
-------
b7c76f7 [FrameworkBundle] FC with EventDispatcher 4.0
This PR was squashed before being merged into the 4.0-dev branch (closes#22779).
Discussion
----------
[4.0][BC Break] Removed BC layers for ControllerResolver::getArguments()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Removes the Backwards Compatibility layer for the `ControllerResolver` that depends on the `ArgumentValueResolver`. ~~There's still 1 bit left in the `HttpKernel`, but I don't quite know how this is solved in the best way:~~
```php
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null, ArgumentResolverInterface $argumentResolver = null)
{
$this->dispatcher = $dispatcher;
$this->resolver = $resolver;
$this->requestStack = $requestStack ?: new RequestStack();
$this->argumentResolver = $argumentResolver;
if (null === $this->argumentResolver) {
@trigger_error(sprintf('As of 3.1 an %s is used to resolve arguments. In 4.0 the $argumentResolver becomes the %s if no other is provided instead of using the $resolver argument.', ArgumentResolverInterface::class, ArgumentResolver::class), E_USER_DEPRECATED);
// fallback in case of deprecations
$this->argumentResolver = $resolver;
}
}
```
~~The 4th argument is now mandatory, but I can't make it mandatory without switching it with the request stack.~~
- ~~I can make both mandatory~~
- ~~I can make it `?RequestStack`~~
- ~~I can switch the arguments~~
~~Each of those area a BC break but for the request stack or the switch, there is no BC layer yet (could be done in 3.4).~~
Commits
-------
64ac6e5 [4.0][BC Break] Removed BC layers for ControllerResolver::getArguments()
This PR was merged into the 4.0-dev branch.
Discussion
----------
[Serializer] Remove a now useless call to method_exists
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
6425f85 [Serializer] Remove a now useless call to method_exists
This PR was squashed before being merged into the 2.7 branch (closes#22748).
Discussion
----------
[Intl] Fix bin/common.php PHP7 compatibility
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22735
| License | MIT
Created for Symfony 2.7 version which is the oldest maintained impacted branch.
Commits
-------
c2ccf36 [Intl] Fix bin/common.php PHP7 compatibility
This PR was squashed before being merged into the 3.3 branch (closes#22787).
Discussion
----------
[MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | -
| Fixed tickets | #22712
| License | MIT
This resolves the issue discussed in https://github.com/symfony/symfony/issues/22712. This works on both Windows and Linux. Specifically it removes the additional hanging that was caused on Windows when attempting to write/close a TCP socket that's not open on the other end in asynchronous mode.
Commits
-------
be60aa401f [MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows
This PR was merged into the 3.3 branch.
Discussion
----------
Use 0.0.0.0 as the server log command host default.
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | -
| Fixed tickets | -
| License | MIT
This fixes the `server:log` command on Windows when run with default settings. The current setting `0` has no meaning on Windows, and `0.0.0.0` is the standard "listen on all addresses/interfaces", so should be the most compatible. It works on both Linux and Windows for me this way.
I mentioned this in another PR where the logger config has the same issue on Windows:
https://github.com/symfony/symfony-standard/pull/1077
Commits
-------
3fcc810dd7 Use 0.0.0.0 as the server log host default.
* 3.4:
typo
CI fixes
Improved how profiler errors are dispalyed on small screens
bumped Symfony version to 3.3.0
updated VERSION for 3.3.0-RC1
updated CHANGELOG for 3.3.0-RC1
* 3.3:
typo
CI fixes
Improved how profiler errors are dispalyed on small screens
bumped Symfony version to 3.3.0
updated VERSION for 3.3.0-RC1
updated CHANGELOG for 3.3.0-RC1
* 3.2:
removed unneeded annotation in tests
[Intl][Form] Update tests, TimeZoneTransformer, and DateTimeToLocalizedStringTransformer for the GMT and UTC split in ICU
remove Security deps from the require section
[Intl] Update ICU data to 59.1
* 2.8:
[Intl][Form] Update tests, TimeZoneTransformer, and DateTimeToLocalizedStringTransformer for the GMT and UTC split in ICU
[Intl] Update ICU data to 59.1
* 2.7:
[Intl][Form] Update tests, TimeZoneTransformer, and DateTimeToLocalizedStringTransformer for the GMT and UTC split in ICU
[Intl] Update ICU data to 59.1
This PR was squashed before being merged into the 2.7 branch (closes#22627).
Discussion
----------
[Intl] Update ICU data to 59.1
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
The [GMT timezone has been split from the UTC](http://site.icu-project.org/download/59) timezone [in CLDR](http://cldr.unicode.org/index/downloads/cldr-31) (which ICU is based on).
For example, the code blow:
* before ICU 59.1 would return "GMT" in all cases
* with ICU 59.1 it returns "UTC" for the first three ('z', 'zz', 'zzz')
and "Coordinated Universal Time" for the last two ('zzzz', 'zzzzz').
```php
foreach (['z', 'zz', 'zzz', 'zzzz', 'zzzzz'] as $pattern) {
$formatter = new \IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('UTC'), IntlDateFormatter::GREGORIAN, $pattern);
var_dump($formatter->format(new \DateTime('@0')));
}
```
Similarly Form's `DateTimeToLocalizedStringTransformer` is also affected:
```php
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);
var_dump($transformer->transform(new \DateTime('2010-02-03 04:05:06 UTC')));
// ICU 58.2: '03.02.2010, 04:05:06 GMT'
// ICU 59.1: '03.02.2010, 04:05:06 Koordinierte Weltzeit'
```
Refer to added and modified test cases for more changes. I split this PR in two commits for easier review. First commit updates ICU data (generated files), the second updates code and test cases to be compatible with updated data.
Commits
-------
5d3d1b25e0 [Intl][Form] Update tests, TimeZoneTransformer, and DateTimeToLocalizedStringTransformer for the GMT and UTC split in ICU
00acb37205 [Intl] Update ICU data to 59.1
The [GMT timezone has been split from the UTC](http://site.icu-project.org/download/59) timezone [in CLDR](http://cldr.unicode.org/index/downloads/cldr-31) (which ICU is based on).
For example, the code blow:
* before ICU 59.1 would return "GMT" in all cases
* with ICU 59.1 it returns "UTC" for the first three ('z', 'zz', 'zzz')
and "Coordinated Universal Time" for the last two ('zzzz', 'zzzzz').
```php
foreach (['z', 'zz', 'zzz', 'zzzz', 'zzzzz'] as $pattern) {
$formatter = new \IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, new \DateTimeZone('UTC'), IntlDateFormatter::GREGORIAN, $pattern);
var_dump($formatter->format(new \DateTime('@0')));
}
```
Similarly Form's `DateTimeToLocalizedStringTransformer` is also affected:
```php
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);
var_dump($transformer->transform(new \DateTime('2010-02-03 04:05:06 UTC')));
// ICU 58.2: '03.02.2010, 04:05:06 GMT'
// ICU 59.1: '03.02.2010, 04:05:06 Koordinierte Weltzeit'
```
Refer to added and modified test cases for more changes. I split this PR in two commits for easier review. First commit updates ICU data (generated files), the second updates code and test cases to be compatible with updated data.
This PR was merged into the 3.2 branch.
Discussion
----------
[FrameworkBundle] remove Security deps from the require section
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
These requirements have been moved in #20075 before and are still
present in the `require-dev` section.
see symfony/flex#14
Commits
-------
c690256966 remove Security deps from the require section
* 3.2:
Fix errors not rethrown even if not handled by console.error listeners
[VarDumper] Fix dumping of non-nested stubs
[Security] Avoid unnecessary route lookup for empty logout path
respect inline level when dumping objects as maps
Test case for not in-lined map-objects
* 2.8:
Fix errors not rethrown even if not handled by console.error listeners
[VarDumper] Fix dumping of non-nested stubs
[Security] Avoid unnecessary route lookup for empty logout path
* 2.7:
Fix errors not rethrown even if not handled by console.error listeners
[VarDumper] Fix dumping of non-nested stubs
[Security] Avoid unnecessary route lookup for empty logout path
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Process] Fix incorrectly calling PHP process when path contains space
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22556
| License | MIT
I have PHP installed at "D:\Program Files\PHP" which contains a space. `PhpExecutableFinder` found it but then `PhpProcess` splitted the path by space. This PR fixes it. I wanted to write a test but I don't know ho to do it properly since it is dependent on the location where PHP is installed and I can't even mock `PhpExecutableFinder` because it is hardcoded dependency and an implementation detail.
Commits
-------
9c08109 Fix incorrectly calling PHP process on Windows when path contains space
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fixing missing "exclude" functionality from PSR4 loader
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | TODO
When the PSR4 loader was added in #21289, @nicolas-grekas said this:
> given that glob() is powerful enough to include/exclude dirs, I removed the Test special exclusion (source: https://github.com/symfony/symfony/pull/21289#issuecomment-272821106)
But, I don't believe that's true! [Glob is all about inclusion, not exclusion](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) - the maximum you can exclude is a single character. Thus, I've marked this as a bug.
My motivation came from upgrading KnpU to the new 3.3 DI stuff. We have many directories (40) in `src/`, and listing them all one-by-one in `resource:` is crazy - the `resource` line would be ~350 characters long and quite unreadable. What I really want to do is include *everything* and then exclude few directories. I tried to do this with `glob`, but it's not possible.
This PR allows for something like this:
```yml
services:
_defaults:
public: false
# ...
AppBundle\:
resource: '../../src/AppBundle/*'
exclude: '../../src/AppBundle/{AppBundle.php,Entity}'
```
This works *beautifully* in practice. And even if I forget to exclude a directory - since the services are private - **they're ultimately removed from the container anyways**. In fact, the *only* reason I need to exclude *anything* is because of the new "service argument resolver", which causes entities to not be properly removed from the compiled container.
Thanks!
Commits
-------
7d07f19459 Allowing prototype/PSR4 service loading ability to exclude, because glob doesn't support this
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Remove polyfill-util dependancy from security-core
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Security-core no longer directly depends upon polyfill-util since #16382.
This does not change the existing dependancy tree as polyfill-util is
transitivly depended on via polyfill-php56.
Commits
-------
fb140aa939 Remove polyfill-util dependancy from security-core
This PR was merged into the 3.3-dev branch.
Discussion
----------
[TwigBundle] service workflow.twig_extension should stay public
| Q | A
| ------------- | ---
| Branch? | master (3.3)
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
While it's not really required for this service to be public AFAIK, it was not made private when introducing it in 3.2. Which means it should stay public in upper branches. But [since we now default to `public: false`](https://github.com/symfony/symfony/pull/22615) in every service config file, it's currently private in 3.3.
I had a quick look on commits merged after this PR and didn't find any other similar case.
Commits
-------
5d07c6aa76 [TwigBundle] service workflow.twig_extension should stay public
Security-core no longer directly depends upon polyfill-util since #16382.
This does not change the existing dependancy tree as polyfill-util is
transitivly depended on via polyfill-php56.
This PR was merged into the 3.2 branch.
Discussion
----------
[Yaml] respect inline level when dumping objects as maps
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22392
| License | MIT
| Doc PR |
Commits
-------
3cca48c715 respect inline level when dumping objects as maps
4f5c149798 Test case for not in-lined map-objects
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] Avoid unnecessary route lookup for empty logout path
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no-ish
| Deprecations? | no
| Tests pass? | yes/no
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
i first included this with #22572 where having `logout: { path: ~ }` makes more sense for disabling logout path matching/generation. But currently it's already allowed and causes an unneeded route lookup and url generation.
Commits
-------
2967807b14 [Security] Avoid unnecessary route lookup for empty logout path
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX] Making the RegisterControllerArgumentLocatorsPass throw exception on bad types
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | maybe
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | n/a
Suppose you type-hint a controller arg with a non-existent class:
```php
public function fooAction(FakeClass $foo)
```
Current error:
> Class AppBundle\Controller\FakeClass does not exist
(from `ParamConverterListener`, and only when you hit that route)
New error:
> Cannot determine controller argument for "AppBundle\Controller\BlogController::indexAction()
": the $foo argument is type-hinted with the non-existent class or interface: "AppBundle\Con
troller\FakeClass". Did you forget to add a use statement?
(at build time)
The extra `Did you forget to add a use statement?` only shows up if it appears you likely forgot a `use` statement.
I think this will be a really common error (especially forgetting the `use` statement)... so let's make it a *really* nice error! An alternative would be to enhance the args resolver to throw a clearer exception when no arg can be wired and the type-hint is bad (we would also need to make the `ParamConverterListener` stop throwing the current error... so that the args resolver would have the opportunity to do that. Disadvantage would be that this error would only happen when you hit the route, not at build time.
Cheers!
Commits
-------
22b905226d Making the RegisterControllerArgumentLocatorsPass throw an exception on a bad type-hint
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22657#issuecomment-299728726
| License | MIT
| Doc PR | N/A
Same as #22657 for the renaming of `DebugAccessDecisionManager` into `TraceableAccessDecisionManager`. Indeed, I think we also require to redeclare the old `DebugAccessDecisionManager` for composer `classmap-authoritative` autoloading strategy & classmap dumper.
AppVeyor failures unrelated.
Edit: Re-thinking about it, it's probably not very common to dump the classmap and use the `classmap-authoritative` strategy when using those classes... That's to say: in debug mode/dev env. So it may be the reason why the class wasn't redeclared on contrary of `DefinitionDecorator`.
Commits
-------
5b123b9674 [Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Fix errors not rethrown even if not handled by console.error listeners
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/22678
| License | MIT
| Doc PR | n/a
https://github.com/symfony/symfony/pull/22261 has been squashed while revisiting error handling, this fixes it again while keeping latest changes intact.
__code__
```php
public function execute(InputInterface $input, OutputInterface $output) {
$this->barr();
}
public function bar() { }
```
__before__
![before](http://image.prntscr.com/image/38aa3b46fed6439ead693908ab104fb3.png)
__after__
![after](http://image.prntscr.com/image/071322bfa52247c6a02eac6ef9d8284a.png)
Commits
-------
75f098fcb8 Fix errors not rethrown even if not handled by console.error listeners
This PR was merged into the 3.3-dev branch.
Discussion
----------
Fixing a bug where abstract classes were wired with the prototype loader
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | n/a
The prototype/PSR-4 loader currently tries to wire abstract classes. The problem is if, for example, you have, for example:
```php
abstract class BaseCommand extends Command
{
}
```
If this is registered as a service, and you have `autoconfigure`, then the console `Application` will try to use this a command.
Was there some reason abstract classes were originally allowed to be registered as services with the PSR4/prototype loader? I don't know if there is a real use-case for registering abstract classes. If you wanted to use that service as a parent service... then you'll probably be configuring it yourself anyways. We could also fix this by changing all tags compiler passes to skip classes that are abstract... *if* there is a use-case for Abstract classes being auto-registered.
Cheers!
Commits
-------
5326bab10a Fixing a bug where abstract classes were wired
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Do not throw autowiring exceptions for a service that will be removed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no (arguable)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Hi guys!
tl;dr Do no throw a "Cannot autowire service id foo_bar" if that service (`foo_bar`) is private and is ultimately removed from the container.
I ran into a problem with the new PSR-4 service loader: our existing projects often contains directories with a mixture of services and model classes. In reality, that's not a problem: since the services are private, if any "extra" classes are registered as service, they're removed from the container because they're not referenced. In other words, the system is great: model classes do *not* become services naturally... because nobody tries to inject them as services.
However, if your model classes have constructor args... then things blow up on compilation. This fixes that: it delays autowiring errors until after `RemoveUnusedDefinitionsPass` runs and then does *not* throw those exceptions if the service is gone.
Cheers!
Commits
-------
f4913feaa8 Fixing a bug where services that were eventually removed could cause autowire errors
* 3.2:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
fixed CS
fixed CS
[DI] Fix PhpDumper blank lines around namespace
fixed CS
[Workflow] fix use directives
[Workflow] Move twig extension registration to twig bundle
Filesystem: annotate the one network test with a "network" group.
[DependencyInjection] Don't store default deprecation template in every service definition instance
* 2.8:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
* 2.7:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
This PR was merged into the 2.7 branch.
Discussion
----------
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/recipes/issues/46
| License | MIT
| Doc PR | N/A
As spotted in https://github.com/symfony/recipes/issues/46, there is no reason to call `registerBundles` on the kernel instance, as it's already booted. So we just have to use `getBundles` instead and `registerBundles` can be implemented in a non-rewindable way, as done with flex.
Commits
-------
040edfec4a [FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Do not duplicate Helper::strlen() code
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Commits
-------
01c2c099a4 [Console] Do not duplicate Helper::strlen() code
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Fix "Locale class not found" in AboutCommand
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Found testing http://fabien.potencier.org/symfony4-demo.html with docker `php:7.1`
Commits
-------
0269f9d422 [FrameworkBundle] Fix "Locale class not found" in AboutCommand
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] Move twig extension registration to twig bundle
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | not really
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
It's probably very late, but I think the twig extension registration is supposed to be done from the `TwigBundle` rather than the `FrameworkBundle`. Fortunately, it doesn't cause any issue currently when using the framework bundle and the workflow component without twig, because it only creates a `workflow.twig_extension` service you'll probably never call, and the `twig.extension` tag is never processed. But still, creates a useless service that cannot be called (and is not removed because it's public).
So this PR aims for consistency over other twig extensions registration, and removing this service when not using twig.
It isn't a BC break to me, as you usually already use the `TwigBundle` for other extensions.
Commits
-------
3fc80d10ef [Workflow] Move twig extension registration to twig bundle
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] KernelTestCase: allow to provide the kernel class with a var
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | yes, but must-have for the new project structure when using flex
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22661
| License | MIT
| Doc PR | todo in https://symfony.com/doc/current/testing.html#your-first-functional-test
So, when using flex, the new `phpunit.xml.dist` will be:
```diff
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
- <server name="KERNEL_DIR" value="etc/" />
+ <server name="KERNEL_CLASS" value="App\Kernel" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
```
As it may cause issues when refactoring, I added a `class_exists` check with an appropriate exception to indicate the class is either not found or not autoloadable.
Commits
-------
4f68912552 [FrameworkBundle] KernelTestCase: allow to provide the kernel class with a var
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] fix use directives
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Spotted while creating https://github.com/symfony/symfony/pull/22652
Commits
-------
08f4ad2275 [Workflow] fix use directives
* 2.8:
fixed CS
[DI] Fix PhpDumper blank lines around namespace
fixed CS
Filesystem: annotate the one network test with a "network" group.
[DependencyInjection] Don't store default deprecation template in every service definition instance
This PR was merged into the 3.3-dev branch.
Discussion
----------
Improved the stack traces that don't contain a function
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
When a trace doesn't have a method/function associated, we display `n/a` and the file path below it. This usually happens in the first line of the stack traces. I don't think this looks OK, so I'm proposing to change it as follows:
### Before
![before-exception](https://cloud.githubusercontent.com/assets/73419/25782450/ae521cc6-334b-11e7-9e22-b31342667f6c.png)
### After
![after-exception](https://cloud.githubusercontent.com/assets/73419/25782451/b1b9957e-334b-11e7-812f-8c24ab8872df.png)
Commits
-------
9457558457 Improved the stack traces that don't contain a function
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebLink][TwigBundle] Fix registration of the twig extension
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | See http://symfony.com/blog/new-in-symfony-3-3-weblink-component comments
| License | MIT
| Doc PR | N/A
BTW it is the only extension not using a classic service definition and adding the tag using the `Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass` class.
(Fabbot failure fixed in https://github.com/symfony/symfony/pull/22640)
Commits
-------
3d8a5646e7 [WebLink][TwigBundle] Fix registration of the twig extension
This PR was merged into the 3.3-dev branch.
Discussion
----------
Make the exception pages work when the WebProfilerBundle is not installed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22631
| License | MIT
| Doc PR | -
Commits
-------
98353b0032 Make the exception pages work when the WebProfilerBundle is not installed
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][DX] Fix missing autoconfigure in container debug
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Added missing autoconfigure flag for `debug:container` with service id.
Commits
-------
f50afad839 fixed missing autoconfigure in container debug
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21369
| License | MIT
| Doc PR | N/A
The `return` trick doesn't seem to work, and php is still trying to declare the `DefinitionDecorator` class, which causes the "Cannot declare class ...\DefinitionDecorator, because the name is already in use" error because of the `class_alias` previously declared in `ChildDefinition.php`.
This never happens as soon as the `ChildDefinition` class is used first, as the alias will take hand, but their are some situations, like in some unit test cases it can happen apparently, because `DefinitionDecorator` is used first.
Commits
-------
530849e4b5 [DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use
Tests that require network access can be problematic, because they
depend on some external state not under your control. That can lead to
"random" failures when the code in question actually works fine. The
Filesystem component has one such test, and this commit adds it to the
"network" group (for PHPUnit).
Doing so lets the user skip that particular test, by running phpunit
with the --exclude-group flag. We take advantage of this in Gentoo,
where every user has the ability to run the test suite but network
access is forbidden.
This PR was squashed before being merged into the 3.3-dev branch (closes#22624).
Discussion
----------
debug:container --types (classes/interfaces)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none, but needed in symfony/symfony-docs#7807
| License | MIT
| Doc PR | n/a
In Symfony 3.3, the *type* (i.e. class/interface) is the most important thing about a service. But, we don't have a way for the user to know *what* types are available. This builds on top of `debug:container` to make `debug:container --types`:
<img width="1272" alt="screen shot 2017-05-03 at 3 42 37 pm" src="https://cloud.githubusercontent.com/assets/121003/25678671/8bebacaa-3018-11e7-9cf6-b7654e2cae88.png">
I think we need this for 3.3, so I've made the diff as *small* as possible. We could make improvements for 3.4, but just *having* this is the most important. I could even remove `format` support to make the diff smaller.
~~This depends on #22385, which fixes a "bug" where private services aren't really shown.~~
Thanks!
Commits
-------
25a39c2682 debug:container --types (classes/interfaces)
* 3.2:
[appveyor] Run the test suite on PHP 7.1
[appveyor][3.x] Run the test suite on PHP 7.1
[EventDispatcher] fix merge of #22541 from 2.8
bumped Symfony version to 3.2.9
updated VERSION for 3.2.8
updated CHANGELOG for 3.2.8
bumped Symfony version to 2.8.21
updated VERSION for 2.8.20
updated CHANGELOG for 2.8.20
bumped Symfony version to 2.7.28
updated VERSION for 2.7.27
update CONTRIBUTORS for 2.7.27
updated CHANGELOG for 2.7.27
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Config] Fix resource tracking with new GlobResource
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Right now, resource tracking is done via tracking of directories mtimes, which means a container is rebuilt each time a file is either removed or added, but not when an existing file is modified.
This looks nice on the surface.
BUT.
Most code editors do create a temporary file when you open your code, thus change the parent dir mtime, thus trigger a container rebuild.
When working with PSR-4 loaders, this means each time you just open a file, most of you will trigger a container rebuild.
This is bad :(
Here is a new GlobResource to fix this issue.
Commits
-------
9190e108c1 [Config] Fix resource tracking with new GlobResource
This PR was merged into the 3.3-dev branch.
Discussion
----------
Add some missing docs for the web server bundle
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
This is an alternative to #22471
Commits
-------
987a6819d2 added some missing docs for the web server bundle
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX][FrameworkBundle] Show private aliases in debug:container
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/16388https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/618
| License | MIT
| Doc PR | n/a
By building and compiling the container without `TYPE_REMOVING` passes, private aliases are available (shown when `--show-private` is passed). The ContainerBuilderDebugDumpPass now makes use of the ConfigCache component, removing the need for clearing the cache to get the debug:container output up to date (in sync with latest config).
Config
-------
```yaml
services:
AppBundle\Foo:
public: false
foo_consumer1:
class: AppBundle\Foo
arguments: [ '@AppBundle\Foo' ]
foo_consumer2:
class: AppBundle\Foo
arguments: [ '@AppBundle\Foo' ]
foo_alias:
alias: AppBundle\Foo
foo_private_alias:
public: false
alias: AppBundle\Foo
```
Before
-------
![before](http://image.prntscr.com/image/2a69485a4a764316a90260b4e3dfc2a2.png)
After
------
![after](http://image.prntscr.com/image/ea42daa0e5c94841a28dd256450dc8ef.png)
Commits
-------
883723ef53 Show private aliases in debug:container
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Defaults to public=false in all service config files
| 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 | -
This is what we call "eating your own dog food" :)
Made me realize that we need a tweak to the defaults<>ChildDefinition conflict we have now:
tags should be applied, and there should be *no* conflict when everything is set *explicitly* on the child definition.
Commits
-------
0656284f7f [DI] Defaults to public=false in all service config files
This PR was merged into the 3.2 branch.
Discussion
----------
[EventDispatcher] fix merge of #22541 from 2.8
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This cleans up a test case that was merged from 2.8 into 3.2 here: 824dc8ba5f
@fabpot due to different implementations I created 2 PR's:
2.8: https://github.com/symfony/symfony/pull/22541
3.2: https://github.com/symfony/symfony/pull/22568
So the 2.8 merge into 3.2 of my change-set introduced some unused variable `$isWrapped` here: 824dc8ba5f (diff-af3c4fbca8bb77957c00087543ae5a4dR113)
This PR just cleans it up and also removes the data provider 😉
Commits
-------
f67eba8 [EventDispatcher] fix merge of #22541 from 2.8
* 3.2:
fixed tests
fixed merge
Fix minor phpdoc mismatches with the code(detected by phan)
[Asset] Starting slash should indicate no basePath wanted
[Security] Fix phpdoc logout listener
[EventDispatcher] fix getting priorities of listeners during dispatch
Add iconv extension to suggested dependencies
Fix minor typo in the main README.md
Allow Upper Case property names in ObjectNormalizer
[EventDispatcher] fix: unwrap listeners for correct info
* 2.8:
Fix minor phpdoc mismatches with the code(detected by phan)
[Asset] Starting slash should indicate no basePath wanted
[Security] Fix phpdoc logout listener
Add iconv extension to suggested dependencies
Fix minor typo in the main README.md
Allow Upper Case property names in ObjectNormalizer
[EventDispatcher] fix: unwrap listeners for correct info
* 2.7:
Fix minor phpdoc mismatches with the code(detected by phan)
[Asset] Starting slash should indicate no basePath wanted
[Security] Fix phpdoc logout listener
Fix minor typo in the main README.md
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Profiler] DataCollector: Remove unused static property
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Unless I missed something, any usage of this property were removed in https://github.com/symfony/symfony/pull/21638.
Commits
-------
96743e69ad [Profiler] DataCollector: Remove unused static property
Now that inherit_tags has been removed, 3.3 has the same functionality as 3.2: tags
are *never* cascaded from parent to child (but you tags do inherit from defaults
to a service and instanceof to a service).
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] json login listener: ensure a json response is sent on bad request
| Q | A
| ------------- | ---
| Branch? | master (3.3)
| Bug fix? | yesish
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
I would have simply recommended to set the proper format when declaring the route:
```yml
# routing.yml
api_login:
path: /login
defaults: { _format: json }
```
but, since https://github.com/symfony/symfony/pull/22477 has been merged, and considering https://github.com/symfony/symfony/pull/22477#issuecomment-295897629:
> my point above regarding checking the content type is so that one could use form_login and json_login in parallel on the same routes and within the same firewall
we may consider setting the request format to json when throwing the `BadRequestHttpException`, so used conjointly with the TwigBundle, the exception is rendered using the `exception.json.twig` template.
ping @lsmith77
(An alternative would be to check the Accept header to set the request format to json if it's the preferred one instead of doing it each time we throw the exception. But Symfony never used such content negotiation AFAIK, and I think it's safe enough to assume someone sending json is expecting json as ouput for exceptions.)
Commits
-------
4427cf9157 [Security] json login listener: ensure a json response is sent on bad request
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Throw useful exception on bad XML argument tags
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22525
| License | MIT
| Doc PR | -
I still think that the feature request in #22525 would make things better.
But at least, let's make thing fail loudly, instead of silently today, with the associated usual wtfs :)
Commits
-------
91828ecd17 [DI] Throw useful exception on bad XML argument tags
This PR was squashed before being merged into the 2.7 branch (closes#22453).
Discussion
----------
Fix minor phpdoc mismatches with the code(detected by phan)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | no
Fix minor mismatches between phpdoc and the type of the code itself, detected by etsy/phan (Prevent confusion in the future)
The actual return types of a few functions have changed from int to bool where preg_match or `&` was used.
Fix optional param before required param in src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
The config used and the rest of the output is at https://gist.github.com/TysonAndre/91bed0e16583301f1e6e5cc2a4807081 (Uses some patches to etsy/phan that weren't merged to master yet)
Commits
-------
12f1239565 Fix minor phpdoc mismatches with the code(detected by phan)
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] add Request type json check in json_login
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no, unreleased feature
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | -
follow up to https://github.com/symfony/symfony/pull/22425 to limit the `UsernamePasswordJsonAuthenticationListener` to only requests with appropriate JSON content type.
I am not entirely happy with this implementation but mostly because Symfony out of the box only provides very limited content type negotiation. I guess anyone that wants to tweak the content negotiation will simply need to ensure the Request::$format is set accordingly before the code is triggered.
Commits
-------
045a36b303 add Request type json check in json_login
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Serializer] Add missing normalizer options constants
| Q | A
| ------------- | ---
| Branch? | master (3.3)
| Bug fix? | not really
| New feature? | yesish, but for 3.3 as those options were added on this branch and not released yet
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22537#discussion_r113719848
| License | MIT
| Doc PR | N/A
As seen in https://github.com/symfony/symfony/pull/22537#discussion_r113719848.
@dunglas : I'm not sure about the exposing the `key_type` option as a constant in `ArrayDenormalizer`/`AbstractObjectNormalizer`, as it looks more or less like a detail of the AbstractObjectNormalizer implementation, but anyway it should be in 3.2 if we add it, so I haven't included it here.
However, I wonder if this option shouldn't directly accept a string too, rather than just a `Symfony\Component\PropertyInfo\Type` instance if we want to consider this option "public"?
Commits
-------
b0c414f2c8 [Serializer] Add missing normalizer options constants
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Serializer] Allow to pass csv encoder options in context
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
CSV contents typically are provided by one or many third-parties, not always allowing you to get control over the provided format. In case you need to import csv files with different formats, either you have to instantiate a decoder yourself/inject it instead of the main serializer instance, either you need another serializer instance with a differently configured csv encoder registered within.
This PR allows to configure any encoder option through the context, so you can keep injecting and using the same serializer instance.
Commits
-------
10a76aac15 [Serializer] Allow to pass csv encoder options in context
This PR was merged into the 2.8 branch.
Discussion
----------
Allow Upper Case property names in ObjectNormalizer
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22547
| License | MIT
Same problem that has been fixed here https://github.com/symfony/symfony/pull/22265
and here https://github.com/api-platform/core/pull/1037
ObjectNormalizer returns $id instead of $Id. It is bad naming convention, but is possible
```php
class Entity {
protected $Id;
public function getId()
{
return $this->Id;
}
}
```
Commits
-------
b2b4faa3c0 Allow Upper Case property names in ObjectNormalizer
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Handle bad request format in json auth listener
| Q | A
| ------------- | ---
| Branch? | master (3.3)
| Bug fix? | yesish
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
In https://github.com/symfony/symfony/pull/22034, I wondered myself if we shouldn't throw a dedicated exception to handle bad formatted requests and give more inputs to the client by returning a 400 response with an explicit message.
~~Here is a suggestion, introducing a new `BadRequestFormatException` and using it in `UsernamePasswordJsonAuthenticationListener` whenever there is no custom failure handler set (but someone using its own handler should be able to treat the failure properly too).~~
As discussed with @chalasr , it seems better to directly throw a `BadRequestHttpException` as it's actually out of the whole security process. PR updated.
Commits
-------
93a8cb9cd4 [Security] Handle bad request format in json auth listener
This PR was squashed before being merged into the 3.3-dev branch (closes#22551).
Discussion
----------
[Process] Ecaping of CLI arguments containing slashes on Windows
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22549
| License | MIT
Actually only the first argument - the command needs to be escaped but that would need another condition. I think it should be OK.
Commits
-------
0d073128de [Process] Ecaping of CLI arguments containing slashes on Windows
This PR was merged into the 3.3-dev branch.
Discussion
----------
Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes (removing risky behavior)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | see #22530
| License | MIT
| Doc PR | n/a
This PR *prohibits* using `autoconfigure`, `_instanceof` and `_defaults` for ChildDefinition.
Additionally, I added many "integration" test cases: we need to test and prove all edge cases. These are in the `integration/` directory: the `main.yml` file is parsed and compared to `expected.yml`. Both are in YAML to ease comparing the before/after. We need to check these out and make sure they're right and we're not missing anything else.
This PR removes MANY of the "wtf" cases, but there are still 4 that I know of... and of course they all deal with parent-child stuff :).
A) [MAJOR] [autoconfigure_parent_child_tags](https://github.com/symfony/symfony/pull/22563/files#diff-fd6cf15470c5abd40156e4e7dc4e7f6d) `instanceof` tags from autoconfigure are NEVER applied to the child (you can't set `autoconfigure` directly on a Child, but you still can set it on a parent and inherit it... sneaky). We could throw an Exception I suppose to prevent this `autoconfigure` from cascading from parent to child... but it's tricky due to `instanceof`.
B( [MAJOR] [instanceof_parent_child](https://github.com/symfony/symfony/pull/22563/files#diff-14666e9a25322d44b3c2c583b6814dc2) `instanceof` tags that are applied to the parent, are not applied to the child. Again, you can't set `instanceof` directly on a Child, but you *can* set it on a parent, and have that cascade to the child. Like before, we could maybe throw an exception to prevent this.
C) [MINOR] ([autoconfigure_child_not_applied](https://github.com/symfony/symfony/pull/22563/files#diff-3372a1dcaf3af30d14a7d0a6c8bfa988)) automatic `instanceof` will not be applied to the child when the parent class has a different (non-instanceof-ed) class. If we could throw an exception for (A), then it would cover this too.
D) `_tags` from defaults are never used (unless you have inherit_tags) - fixed in #22530
A, B & C are effectively caused by there being a "sneaky" way to re-enable `autoconfigure` and `instanceof` for ChildDefinition... which opens up wtf cases.
## Wait, why not support `_defaults`, `autoconfigure` and `_instanceof` for child definitions?
1 big reason: reduction of wtf moments where we arbitrarily decide override logic. PLUS, since `_defaults`, `instanceof` and `autoconfigure` *are* applied to parent definitions, in practice (other than tags), this makes no difference: the configuration will still pass from parent down to child.
Also, using parent-child definitions is already an edge case, and this *simply* prevents *just* those services from using the new features.
## Longer reasons why
The reason behind this is that parent-child definitions are a different mechanism for "inheritance"
than `_instanceof` and `_defaults`... creating some edge cases when trying to figure out which settings "win". For example:
```yml
# file1.yml
services:
_defaults:
public: false
ChildService:
parent: parent_service
# file2.yml
services:
_defaults:
public: true
ParentService: ~
```
Is `ChildDefinition` `public: true` (so the parent
overrides the child, even though it only came from _defaults) or `public: false` (where
the child wins... even though it was only set from its _defaults)?
Or, if ParentService is explicitly set to `public: true`, should that override the `public: false` of ChildService (which it got from its `_defaults`)? On one hand, ParentService is being explicitly
set. On the other hand, ChildService is explicitly in a file settings `_defaults` `public: false`
There's no correct answer.
There are also problems with `_instanceof`. The importance goes:
> defaults < instanceof < service definition
But how do parent-child relationships fit into that? If a child has public: false
from an _instanceof, but the parent explicitly sets public: true, which wins? Should
we assume the parent definition wins because it's explicitly set? Or would the
_instanceof win, because that's being explicitly applied to the child definition's
class by an _instanceof that lives in the same file as that class (whereas the parent
definition may live in a different file).
Because of this, @nicolas-grekas and I (we also talked a bit to Fabien) decided that
the complexity was growing too much. The solution is to not allow any of these
new feature to be used by ChildDefinition objects. In other words, when you want some
sort of "inheritance" for your service, you should *either* giving your service a
parent *or* using defaults and instanceof. And instead of silently not applying
defaults and instanceof to child definitions, I think it's better to scream that it's
not supported.
Commits
-------
a943b96d42 Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console][HttpKernel] Avoid reflection-based registration for command public services
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22410#issuecomment-298158585
| License | MIT
| Doc PR | n/a
By mapping commands ids by their alias in `console.command.ids` (even if the alias is not registered in the container for public services), then skipping reflection if the predictable alias exists as a key of `console.command.ids`.
Please note that the whole command service registration process is far from ideal.
I'm working on changing this for 3.4 in a transparent way regarding end users, leveraging PSR-11 to make the console component DI friendly, allowing to register commands as true private services (no more public aliases) and providing laziness for those.
Commits
-------
6c1b384b75 Avoid reflection-based registration for command public services
This PR was squashed before being merged into the 3.3-dev branch (closes#22564).
Discussion
----------
Fixing problem where _defaults set to null was seen as a service
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
```yml
services:
_defaults:
```
If you leave `_defaults` empty (i.e. null), you got a bad error before. Now it's better :)
Before:
>The definition for "_defaults" has no class. If you intend to inject this service dynamicall
y at runtime, please mark it as synthetic=true. If this is an abstract definition solely use
d by child definitions, please add abstract=true, otherwise specify a class to get rid of th
is error.
After:
> Service "_defaults" key must be an array, "NULL" given in "/path/to/services.yml"
Commits
-------
4b7e148a9b Fixing problem where _defaults set to null was seen as a service
This PR was squashed before being merged into the 2.7 branch (closes#22528).
Discussion
----------
[Asset] Starting slash should indicate no basePath wanted
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes-ish... and no-ish
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
**Important** View the second commit for an accurate diff. The first commit just renames some strings in a test for clarity.
When we moved `PathPackage` from `Templating` to `Asset`, we actually changed its behavior. Assume that we're deployed under a `/subdir` subdirectory:
**Before** `{{ asset('/main.css') }}` would *not* have the base path prefixed -> `/main.css`
**After** `{{ asset('/main.css') }}` *does* have the base path prefixed -> `/subdir/main.css`
3adff11d72/src/Symfony/Component/Templating/Asset/PathPackage.php (L61-L63)
This PR simply reverses that, to the *previous* behavior. This *is* a BC break... and also arguably a bug fix :). Interestingly, when we changed the behavior the first time (i.e. broke BC), I don't think that anyone noticed. It should only affect users deployed under a subdirectory.
Why do I care? I'm using the new `JsonManifestVersionStrategy` with a library that is outputting paths that *already* include my subdirectory:
```json
{
"build/main.css": "/subdir/build/main.abc123.css"
}
```
So, I do not want Symfony to detect the `/subdir` and apply it a second time.
Commits
-------
3cc096b540 [Asset] Starting slash should indicate no basePath wanted
Also, not allowing arguments or method calls for autoconfigure. This is a safety
mechanism, since we don't have merging logic. It will allow us to add this in the
future if we want to.
The reason is that parent-child definitions are a different mechanism for "inheritance"
than instanceofConditionas and defaults... creating some edge cases when trying to
figure out which settings "win". For example:
Suppose a child and parent definitions are defined in different YAML files. The
child receives public: false from its _defaults, and the parent receives public: true
from its _defaults. Should the final child definition be public: true (so the parent
overrides the child, even though it only came from _defaults) or public: false (where
the child wins... even though it was only set from its _defaults). Or, if the parent
is explicitly set to public: true, should that override the public: false of the
child (which it got from its _defaults)? On one hand, the parent is being explicitly
set. On the other hand, the child is explicitly in a file settings _defaults public
to false. There's no correct answer.
There are also problems with instanceof. The importance goes:
defaults < instanceof < service definition
But how does parent-child relationships fit into that? If a child has public: false
from an _instanceof, but the parent explicitly sets public: true, which wins? Should
we assume the parent definition wins because it's explicitly set? Or would the
_instanceof win, because that's being explicitly applied to the child definition's
class by an _instanceof that lives in the same file as that class (whereas the parent
definition may live in a different file).
Because of this, @nicolas-grekas and I (we also talked a bit to Fabien) decided that
the complexity was growing too much. The solution is to not allow any of these
new feature to be used by ChildDefinition objects. In other words, when you want some
sort of "inheritance" for your service, you should *either* giving your service a
parent *or* using defaults and instanceof. And instead of silently not applying
defaults and instanceof to child definitions, I think it's better to scream that it's
not supported.
This PR was squashed before being merged into the 3.3-dev branch (closes#22531).
Discussion
----------
Throwing an exception if the class is not found
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
We now throw an exception if the user makes a mistake with their PSR-4 prefix and namespace. For example:
```yml
AppBundle\Controller\:
resource: '../../src/AppBundle/{Controller}'
public: true
```
I should not have the `\Controller` at the end of the key. Previously, it would silently not import any services from the directory. Now it throws:
> Expected to find class "AppBundle\Controller\Controller\Admin\BlogController" in file "/path/to/project/src/AppBundle/Controller/Admin/BlogController.php" while importing services from resource "../../src/AppBundle/{Controller}", but it was not found! Check the namespace prefix used with the resource.
The only "downside" is that this prevents someone from importing files from a resource that has a file with no class in it (`functions.php`). @nicolas-grekas and I decided today that we can throw an exception now to be safe, and see if anyone has that valid use-case.
Cheers!
Commits
-------
e85bcc9 Throwing an exception if the class is not found
| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | yes
| RFC? | no
| Symfony version | 2.8.19
Same problem that has been fixed here https://github.com/symfony/symfony/pull/22265
and here https://github.com/api-platform/core/pull/1037
ObjectNormalizer returns $id instead of $Id. It is bad naming convention, but is possible
```php
class Entity {
protected $Id;
public function getId()
{
return $this->Id;
}
}
```
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Restore 3.2-like behavior for FormPass, to help BC with Sonata
| 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 | -
I tried updating a Sonata project to 3.3, and found it broken.
The issue is that Sonata uses the constructor arguments of the `form.extension` to create its own `form.extension` service - but borrows its first args from the Symfony one.
Here is the form pass doing that:
https://github.com/sonata-project/SonataCoreBundle/blob/3.x/DependencyInjection/Compiler/FormFactoryCompilerPass.php
And the implementation of the form extension:
https://github.com/sonata-project/SonataCoreBundle/blob/3.x/DependencyInjection/SonataCoreExtension.php
Question: is this covered by the BC policy? It shouldn't to me, because that would prevent *any* service reconfiguration.
Thus, I'm proposing the attached patch, which basically reverts the deprecated `FormPass` in FrameworkBundle to its 3.2 state.
I added a check to the new `FormPass` in the Form component so that it doesn't overwrite such compatibility configurations.
See for corresponding fix on https://github.com/sonata-project/SonataCoreBundle/pull/399
Commits
-------
c97b08e6c0 [FrameworkBundle] Restore 3.2-like behavior for FormPass, to help BC with Sonata
This PR was merged into the 3.3-dev branch.
Discussion
----------
[SecurityBundle] Enhance FirewallContext::getListeners()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/20417#discussion_r91704023, https://github.com/symfony/symfony/pull/20417#discussion_r91704145
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
I think @stof is right.. and the fact we can do this on master currently without the hassle.
cc @chalasr
Commits
-------
ba650783f5 [SecurityBundle] Enhance FirewallContext::getListeners()
This PR was merged into the 2.7 branch.
Discussion
----------
[Asset] Preventing the base path or absolute URL from being prefixed incorrectly
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Fixes an edge case (which I need) where the version strategy returns an absolute URL. Currently, if this happens, the baseUrl or basePath is prefixed - giving `https://baseurl.com/https://pathreturnedfromversioning.com` or `/basePath/https://pathreturnedfromversioning.com`.
I don't see any reason to prevent an absolute URL from being returned by the version strategy. And it's not a BC break, because the previous paths that were returned were nonsense.
Cheers!
Commits
-------
746c91eea4 Preventing the base path or absolute URL from being prefixed incorrectly on an absolute URL
* 3.2:
Fixed the flickering when loading complex profiler panels
[Console] Fix bar width with multilines ProgressBar's format
[DI] Add missing check in PhpDumper
[Serializer] XmlEncoder: fix negative int and large numbers handling
[Console] Fix dispatching throwables from ConsoleEvents::COMMAND
* 2.8:
Fixed the flickering when loading complex profiler panels
[DI] Add missing check in PhpDumper
[Serializer] XmlEncoder: fix negative int and large numbers handling
[Console] Fix dispatching throwables from ConsoleEvents::COMMAND
* 2.7:
[DI] Add missing check in PhpDumper
[Serializer] XmlEncoder: fix negative int and large numbers handling
[Console] Fix dispatching throwables from ConsoleEvents::COMMAND
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Review console.ERROR related behavior
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR is a follow up of #18140 that I wanted to do since a few weeks.
It enhances this work with fixes and behavior changes.
It embeds #22435 and resolves issues like the one described in #20808.
- makes ConsoleErrorEvent *not* extend the deprecated ConsoleExceptionEvent
- replace ConsoleErrorEvent::markErrorAsHandled by ConsoleErrorEvent::setExitCode
- triggers the deprecation in a more appropriate moment
- renames ExceptionListener to ErrorListener
- tweaks the behavior in relation to #22435
Commits
-------
a7c67c9ab2 [Console] Review console.ERROR related behavior
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Cache] Keep only hit/miss (not values) in TraceableAdapter/Cache
| 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 | -
Right now, TraceableAdapter and TraceableCache both keep all fetched values.
This exhaustive reporting is too much data gathering to me.
Here is a PR that keeps only true/false for each hit/miss + all corresponding keys.
That can still be a lot of data (one item per fetched key) - but a bit better.
Should we go further in stats-only gathering? Or should we *not* do this and keep collecting *all* the values?
The PR also fixes "Traversable" handling.
ping @Nyholm
The profiler panel still works (although breaking lines in the middle of words is strange, but this is the profiler's CSS, nothing special to this specific case).
![capture du 2017-04-19 11-40-13](https://cloud.githubusercontent.com/assets/243674/25173586/f9615dd6-24f4-11e7-8d6f-36fb2437c3b6.png)
Commits
-------
0c73c5d [Cache] Keep only hit/miss (not values) in TraceableAdapter/Cache
This PR was squashed before being merged into the 3.2 branch (closes#21958).
Discussion
----------
[Console] Fix bar width with multilines ProgressBar's format
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
The bar width is badly recalculated when we use multilines (``\n``) and bar placeholer (``%bar%``) in ProgressBar's format. The bar width is reduced because multilines is considered as a big oneline. This PR fixes this.
Commits
-------
3d58ab5bad [Console] Fix bar width with multilines ProgressBar's format
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Allow service subscribers to leverage autowiring to know where their locator should be injected
| 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 | -
Commits
-------
e407b3d42e [DI] Allow service subscribers to leverage autowiring to know where the locator should be injected
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Process] Fix BC break: "exec" should remain an internal "detail"
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22476
| License | MIT
| Doc PR | -
Commits
-------
eedcece20b [Process] Fix BC break: "exec" should remain an internal "detail"
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fix inlining conflict by restricting IteratorArgument to Reference[]
| 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 | -
`Reference` found in `ArgumentInterface::getValue()` are currently not inlined.
While trying to do so (hint: I failed), I noticed that the current code is broken for `IteratorArgument` which can contain anonymous `Definition` for now, which are then not inlined correctly.
This PR restricts `IteratorArgument` to arrays of `Reference`, and improves a few related things found while doing it.
(fabbot failure is false positive)
Commits
-------
4d3dce1c0f [DI] Fix inlining conflict by restricting IteratorArgument to Reference[]
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] XmlEncoder: fix negative int and large numbers handling
| Q | A
| ------------- | ---
| Branch? | 2.7 <!-- see comment below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #22329, #22333 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | n/a
Alternative to #22333.
* Negative integers are now handled
* Float are now handled
* Large numbers are converted to float (as the `JsonEncoder` and native PHP functions like `ceil` do)
@vlastv, I've adapted your test. Can you check if it fixes your problem?
Commits
-------
1eeadb0c98 [Serializer] XmlEncoder: fix negative int and large numbers handling
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Fix json_login default success/failure handling
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no (master only)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22483
| License | MIT
| Doc PR | n/a
This makes the `json_login` listener default configuration stateless oriented by:
- Not using the default (redirect based) failure handler, it returns a 401 (json) response containing the failure reason instead
- Not using the default (redirect based) success handler, just let the original request continue instead (reaching the targeted resource without being redirected).
- Setting `require_previous_session` to `false` by default (I have to set it on `form-login` each time I want it to be stateless)
- Removing the options related to redirections (`default_target_path`, `login_path`, ...) from the listener factory, if one wants redirections then one has to write its own handlers, not the inverse
Commits
-------
9749618ff5 Fix json_login default success/failure handling
This PR was squashed before being merged into the 3.3-dev branch (closes#22234).
Discussion
----------
[DI] Introducing autoconfigure: automatic _instanceof configuration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes (mostly, a continuation of a new feature)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/issues/7538
This is a proposal to allow the user to opt into some automatic `_instanceof` config. Suppose I want to auto-tag all of my voters and event subscribers
```yml
# current
services:
_defaults:
autowire: true
_instanceof:
Symfony\Component\Security\Core\Authorization\Voter\VoterInterface:
tags: [security.voter]
Symfony\Component\EventDispatcher\EventSubscriberInterface:
tags: [kernel.event_subscriber]
# services using the above tags
AppBundle\Security\PostVoter: ~
AppBundle\EventListener\CheckRequirementsSubscriber: ~
```
If I'm registering a service with a class that implements `VoterInterface`, when would I ever *not* want that to be tagged with `security.voter`? Here's the proposed code:
```yml
# proposed
services:
_defaults:
autowire: true
autoconfigure: true
# services using the auto_configure_instanceof functionality
AppBundle\Security\PostVoter: ~
AppBundle\EventListener\CheckRequirementsSubscriber: ~
```
The user must opt into this and it only applies locally to this configuration file. It works because each enabled bundle would have the opportunity to add one or more "automatic instanceof" definitions - e.g. SecurityBundle would add the `security.voter` instanceof config, FrameworkBundle would add the `kernel.event_subscriber` instanceof config, etc.
For another example, you can check out the proposed changes to `symfony-demo` - symfony/symfony-demo#483 - the `_instanceof` section is pretty heavy: 81694ac21e/app/config/services.yml (L20)
Thanks!
Commits
-------
18627bf9f6 [DI] Introducing autoconfigure: automatic _instanceof configuration
This PR was merged into the 3.3-dev branch.
Discussion
----------
Persist app bootstrapping logs for logger datacollector
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | yes
| BC breaks? | ?
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21405
| License | MIT
Logs generated during the container build are catched by the BufferingLogger with a special flag.
They are persist by the LoggerDataCollector and are available in the logger profiler.
In the profiler toolbar, the "container build" logs increment the current logs counter (even if the container was previously built).
<img width="540" alt="capture d ecran 2017-02-01 a 20 56 40" src="https://cloud.githubusercontent.com/assets/1017746/22523826/0bc12e4a-e8c1-11e6-830f-7f6238ea7423.png">
<img width="1022" alt="capture d ecran 2017-02-01 a 20 57 55" src="https://cloud.githubusercontent.com/assets/1017746/22523859/2c48a698-e8c1-11e6-9bdb-d85f3e692938.png">
The BufferingLogger now require the cachePath and the filesystem to persist a (unique) container build logs.
If the current workflow is ok, I will update the test coverage (actually they fail). Maybe we can display the appDevDebugProjectContainerCompiler.log content in that logger profile.
Commits
-------
2fd18b5503 [VarDumper] Fine tune dumping log messages
ce3ef6a96e Persist app bootstrapping logs for logger datacollector
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Reduce memory overhead of id normalization
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
1dd3285c91 [DI] Reduce memory overhead of id normalization
The conflict rule already forbids installing releases before 3.3 of the
Asset component. This will bring the constraint in the `require-dev`
section inline with the conflict rule.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Fix fatal error when logging console.error without command
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22449
| License | MIT
| Doc PR | n/a
Happens now that the console.error event is dispatched on command not found, I ran into using `server:run` on 3.3 without `web-server-bundle` enabled:
> PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getName() on null
In this case, this first tries to cast the event input as string (less good than when the command name is available, there're extra quotes around the command name) and, if can't be casted, uses a generic message.
Commits
-------
97129fc611 Fix fatal error when logging console.error without a command
* 3.2:
Make .travis.yml more readable
Fold Travis CI output by component
[VarDumper] Minor tweaks to html/css dumps
Add trhows PHPDoc in Application::run
[Debug] Set exit status to 255 on error
[HttpFoundation] Store IANA's RNG files in the repository
[PropertyInfo] Remove a useless call to count() in SerializerExtractor
[PropertyInfo] Prevent returning int values in some cases.
[HttpFoundation] Fix getClientIp @return docblock
Add @throws phpdoc
unify PHPUnit config files
* 2.8:
Make .travis.yml more readable
Fold Travis CI output by component
Add trhows PHPDoc in Application::run
[Debug] Set exit status to 255 on error
[HttpFoundation] Store IANA's RNG files in the repository
[PropertyInfo] Remove a useless call to count() in SerializerExtractor
[PropertyInfo] Prevent returning int values in some cases.
[HttpFoundation] Fix getClientIp @return docblock
Add @throws phpdoc
unify PHPUnit config files
* 2.7:
Make .travis.yml more readable
Fold Travis CI output by component
Add trhows PHPDoc in Application::run
[Debug] Set exit status to 255 on error
[HttpFoundation] Store IANA's RNG files in the repository
[HttpFoundation] Fix getClientIp @return docblock
Add @throws phpdoc
unify PHPUnit config files
This PR was merged into the 3.3-dev branch.
Discussion
----------
[SecurityBundle] conditionally register user checker FQCN alias
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22466
| License | MIT
| Doc PR |
Commits
-------
eede70a8a2 conditionally register user checker FQCN alias
This PR was squashed before being merged into the 3.3-dev branch (closes#22425).
Discussion
----------
[Security] Allow to set a check_path on json_login listener
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no, master only
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21948, ~~#22423~~
| License | MIT
| Doc PR | n/a
The listener should allow to restrict authentication to a given check_path, as stated in the docs http://symfony.com/doc/master/security/json_login_setup.html
Commits
-------
9f7eb618a4 [Security] Allow to set a check_path on json_login listener
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Workflow] Deprecate the default type of a workflow
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
Before this patch, the default type is "workflow". Most of the time a
"state_machine" is better because it's simpler and it involves less
knowledge to be able to use it.
So this patch deprecate a missing type in Symfony 3.3. And In Symfony
4.0 the default value will become "state_machine".
Commits
-------
004751c [FrameworkBundle][Workflow] Deprecate the default type of a workflow
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Add throws PHPDoc in Application::run()
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | /
| License | MIT
| Doc PR | /
Same idea than merged #22411.
Commits
-------
28332afb38 Add trhows PHPDoc in Application::run
This PR was merged into the 2.7 branch.
Discussion
----------
[Debug] Set exit status to 255 on error
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes (no easily testable in fact)
| Fixed tickets | #20775
| License | MIT
| Doc PR | -
Commits
-------
67e249dc81 [Debug] Set exit status to 255 on error
This PR was squashed before being merged into the 3.3-dev branch (closes#22420).
Discussion
----------
[DI] Make tagged abstract services throw earlier
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
As spotted by @stof in https://github.com/symfony/symfony/pull/22388#issuecomment-293565243, skipping abstract tagged services removes an opportunity to report config mistakes to users.
Instead of skipping them, let's throw as done before (thus reverting #22039, ping @chalasr).
I made `$container->findTaggedServiceIds()` accept a 2nd arg to make this more systematic.
To keep the possibility to have abstract tagged services *for the purpose of tag inheritance*, `ResolveTagsInheritancePass` now resets their tags.
Commits
-------
388e4b3389 [DI] Make tagged abstract services throw earlier
cd06c1297b Revert "minor #22039 Skip abstract definitions in compiler passes (chalasr)"
Before this patch, the default type is "workflow". Most of the time a
"state_machine" is better because it's simpler and it involves less
knowledge to be able to use it.
So this patch deprecate a missing type in Symfony 3.3. And In Symfony
4.0 the default value will become "state_machine".
This PR was merged into the 3.3-dev branch.
Discussion
----------
Enhancing integration test to show that "override" tags show up first
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | not needed
Relates a bit to #22396, in that I'm clarifying and emphasizing the following types of situations:
```yml
services:
_instanceof:
Symfony\Component\Security\Core\Authorization\Voter\VoterInterface:
tags:
# you probably shouldn't set priority here, but let's pretend we did
- { name: security.voter, priority: 100 }
AppBundle\Security\CoolPersonVoter:
tags:
- { name: security.voter, priority: 50 }
```
In the final `Definition`, the tags will appear in this order:
* security.voter, priority 50
* security.voter, priority 100
It works the same for parent-child definitions.
tl;dr; If a service has the same tag multiple times, the one that should be used should appear *earlier* in the Definition. The code already works that way - this test emphasizes it.
Commits
-------
e9b96e5 Enhancing integration test to show that "override" tags always show up first
This PR was merged into the 3.3-dev branch.
Discussion
----------
Add a note about the ServiceLocator class in the changelog
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
In addition to have `container.service_locator` and `container.service_subscriber` based on, this class is useful on its own as it is the one avoiding the need for having the `Container` class filling this role.
Commits
-------
92994f3 Add a note about the ServiceLocator class in the changelog
This PR was merged into the 3.2 branch.
Discussion
----------
[Yaml] add changelog for the DUMP_OBJECT_AS_MAP flag
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #17728
| License | MIT
| Doc PR |
Adds missing changelog entry for the `DUMP_OBJECT_AS_MAP` flag introduced in #17728.
Commits
-------
8fd3602 add changelog for the DUMP_OBJECT_AS_MAP flag
* 3.2:
[2.8] Prevent double registrations related to tag priorities
Prevent double registrations related to tag priorities
[3.2] Prevent double registrations related to tag priorities
This PR was merged into the 3.2 branch.
Discussion
----------
[3.2] Prevent double registrations related to tag priorities
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
#22396 and #22399 on 3.2
Commits
-------
ec6a2f9eba [3.2] Prevent double registrations related to tag priorities
This PR was merged into the 2.8 branch.
Discussion
----------
[2.8] Prevent double registrations related to tag priorities
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
#22396 on 2.8
Commits
-------
2be5821743 [2.8] Prevent double registrations related to tag priorities
This PR was merged into the 2.7 branch.
Discussion
----------
Prevent double registrations related to tag priorities
| 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 | -
The current logic is inconsistent, and allows the same id to be used several times. This makes the first explicit priority to always win.
Commits
-------
6764dcdf39 Prevent double registrations related to tag priorities
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Replace autowiring BC break by regular deprecation
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
It happens that doing so is really easy now. And as discussed in #22295, this should be more friendly to our users.
Commits
-------
0ed087d972 [DI] Replace autowiring BC break by regular deprecation
This PR was merged into the 3.3-dev branch.
Discussion
----------
added a more specialized exception for a better error message
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes/no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
When trying to load a resource, it is very interesting to understand why a resource cannot be loaded. Especially when you get `Cannot load resource "../src/Controller/".`... when the real error is that annotation support is disabled. This PR adds more information in that case.
Commits
-------
aeb9bffa8f added a more specialized exception for a better error message
* 3.2:
Allow terminal dimensions to be set to 0 (unbounded)
[Cache] Remove exception false-positive from FilesystemAdapterTrait
fix risky tests
fix risky tests
[Yaml] release memory after parsing
[HttpFoundation] Fix and test status codes according to IANA's data
Add `use_strict_mode` in validOptions for session
[Console] Inherit phpdoc from OutputFormatterInterface
* 2.8:
fix risky tests
[Yaml] release memory after parsing
[HttpFoundation] Fix and test status codes according to IANA's data
Add `use_strict_mode` in validOptions for session
[Console] Inherit phpdoc from OutputFormatterInterface
* 2.7:
[Yaml] release memory after parsing
[HttpFoundation] Fix and test status codes according to IANA's data
Add `use_strict_mode` in validOptions for session
[Console] Inherit phpdoc from OutputFormatterInterface
This PR was merged into the 3.2 branch.
Discussion
----------
[Cache] Remove exception false-positive from FilesystemAdapterTrait
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20517
| License | MIT
| Doc PR | -
As reported in the linked issue, there seem to be a race condition in FilesystemAdapterTrait (maybe related to realpath cache?).
Let's remove that exception: if the mkdir really fails, the error will be logged later on when a cache entry will be written (or succeed if the race is over.)
Commits
-------
a756db78d0 [Cache] Remove exception false-positive from FilesystemAdapterTrait
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Rework config hierarchy: defaults > instanceof > service config
| 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 | -
Replaces #22294.
The main change is that ChildDefinition does not have "instanceof" applied anymore. All the complexity of the pass came from the merging logic required to deal with them. But in fact, we'd better not have any such logic and just not apply "instanceof" to ChildDefinition (but have them inherit from their parents with the usual logic).
Commits
-------
6d6116b920 Adding an integration test for the hirarchy of defaults, instanceof, child, parent definitions
ab86457b12 [DI] Rework config hierarchy: defaults > instanceof > service config
cbaee55223 [DI] Track changes at the "Definition" level
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Use findDefinition() instead of getDefinition() on aliases
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
The services for which `has()` is called might be aliases at this point so `getDefinition()` gives an exception, I ran into by executing this pass but not the removing ones (skipping ReplaceAliasByActualDefinitionPass) while working on https://github.com/symfony/symfony/issues/16388. Let's make it safe to use independently.
Commits
-------
41f3d1f166 Use findDefinition() instead of getDefinition() after calling has()
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Dotenv] Throwing an error when loading nothing
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
This is a quick fix to prevent anoying when you follow a tutorial using another dotenv component. For example, this code uses [vlucas/phpdotenv](https://packagist.org/packages/vlucas/phpdotenv):
```php
$dotenv = new Dotenv\Dotenv(__DIR__.'/../');
$dotenv->load();
```
Silently failed with symfony/dotenv.
Commits
-------
911bc68991 [Dotenv] Throwing an error when loading nothing
This PR was squashed before being merged into the 3.3-dev branch (closes#22368).
Discussion
----------
[Bridge] [Twig] get and flush only flash sessions you need in getFlashes method
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no ?!
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #22359
| License | MIT
| Doc PR | symfony/symfony-docs
@xabbuh comments about empty array to return
Commits
-------
33b044a [Bridge] [Twig] get and flush only flash sessions you need in getFlashes method
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Populate class of ChildDefinition when its id matches an existing FQCN
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22345
| License | MIT
| Doc PR | -
See linked issue for expected DX.
Instead of doing a "continue", let's throw to force the resolution of any ambiguities.
There is a minor potential BC Break, if one uses an ambiguous FQCN as child-definition id in 3.2 or below.
To me, this should be rare, and easy to fix (compile time only).
The DX enhancement this PR provides looks worth it.
> Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.
Commits
-------
3200d3738a [DI] Populate class of ChildDefinition when its id matches an existing FQCN
This PR was squashed before being merged into the 3.3-dev branch (closes#22239).
Discussion
----------
[Finder] Glob wildcard while using double-star without ending slash
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
This PR allows to use the `Glob::toRegex` method to dump a glob that will match "everything after" while using the double-star without leading slash. `/foo/**` will therefore match `/foo/a` or `/foo/a/b/c` or even `/foo/a/b/c/d.e`.
The use-case for this change is an application allowing its users to match a list of files/folders from such glob pattern.
Happy to add a line in the CHANGELOG and documentation if you feel that would make sense.
Commits
-------
170b0ace2c [Finder] Glob wildcard while using double-star without ending slash
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Dotenv] Throwing an exception when loading a directory
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
8b83b58aa5 Throwing an exception when loading a directory
This PR was squashed before being merged into the 3.3-dev branch (closes#22344).
Discussion
----------
[DX] [TwigBundle] Improve default expand states of exception template
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #22334
| License | MIT
As discussed in #22334 this PR changes the default exception template to more intelligently decide which call stack to initially expand:
- All exceptions are scanned for user code, ignoring the front controller and callbacks
- Only exceptions containing user code are expanded
- If no user code is found the first exception is expanded
Commits
-------
df25691250 [DX] [TwigBundle] Improve default expand states of exception template
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel et al.] Move DataCollector::cloneVar() to lateCollect()
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22166
| License | MIT
| Doc PR | -
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
f83f971c3f [HttpKernel et al.] Move DataCollector::cloneVar() to lateCollect()
This PR was squashed before being merged into the 3.3-dev branch (closes#22273).
Discussion
----------
Add a new Link component
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? |no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | todo
This a proposal to extract HTTP preloading features introduced in #21478 in their own component.
There are some good reasons to do it:
* HTTP preloading is not (only) about assets: this standalone component could be very useful to replace resources embedding in APIs by HTTP/2 pushes like described in [this article](https://evertpot.com/rest-embedding-hal-http2/) by @evert. In such case, there is no reason to carry the whole asset component for an API.
* There is no dependency nor relation at all between the code of the asset compnent and the one I've added for Preloading features
* It makes the code cleaner (no more optional dependency in the `Asset` Twig extension)
This component would also better fit in HttpFoundation than in Asset. But there is no dependency between it and HttpFoundation and it can easily be used with PSR-7 too, so IMO it better belongs in a standalone component.
Btw, ~~~I plan to add support for prefetching to this component. Except a PR soon.~~~ Prefetching and prerendering support added in this PR.
ping @symfony/deciders
Commits
-------
053de25edf Add a new Link component
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fix named args overridding
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22196
| License | MIT
| Doc PR | -
(The exception check in ResolveDefinitionTemplatesPass is not done in ResolveNamedArgumentsPass.)
Commits
-------
0c030d92f9 [DI] Fix named args overridding
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpFoundation] Add `use_strict_mode` in validOptions for session
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9258
| License | MIT
| Doc PR |
PHP ini `session.use_strict_mode` was added in PHP 5.5.2 so I didn't target 2.8 as this still uses PHP 5.3. https://secure.php.net/manual/en/session.configuration.php#ini.session.use-strict-mode
Commits
-------
130ee327d4 Add `use_strict_mode` in validOptions for session
* 3.2:
don't keep internal state between parser runs
Add \Traversable typehint to phpdoc
[ExpressionLanguage] Avoid dependency on ctype
Moved ->setDate() before the deprecation handling.
[Debug] Fix php notice
[VarDumper] Relax tests to adapt for php 7.1rc4
This PR was merged into the 3.3-dev branch.
Discussion
----------
Add Kernel::getProjectDir()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes/no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | not yet
`Kernel::getRootDir()` is misleading. It returns the path where `AppKernel.php` is stored, which is `app/` in Symfony 2/3, but `src/` in Symfony 4. But most of the time, we are using `getRootDir()` to get the project root dir, so `%kernel.root_dir%/../` is a common idiom.
Changing the value of `getRootDir()` would be a hard BC break, so I propose to create a new method, `getProjectDir()` to "replace" `getRootDir()` gradually.
Commits
-------
1f680ccb2d added Kernel::getProjectDir()
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Enhance wording of autowiring exceptions
| 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 | -
> Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. You should maybe alias this class to the existing "i" service; or type-hint against interface "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" instead.
Commits
-------
da792b2ff7 [DI] Enhance wording of autowiring exceptions
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Skip ContainerAwareInterface::setContainer from service_arguments actions registration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
As it would never be used
Commits
-------
ad59e1804f Skip ContainerAwareInterface::setContainer from service_arguments actions registration
This PR was squashed before being merged into the 3.2 branch (closes#22304).
Discussion
----------
Moved $this->setDate() before the deprecation handling.
| Q | A
| ------------- | ---
| Branch? | 3.2 <!-- see comment below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no?
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
https://github.com/symfony/symfony/pull/22036 merged the patch into the wrong place; the `$this->setDate()` happens after the deprecation handling, so it does not always get called.
See also https://www.drupal.org/node/2712647?page=1#comment-12025349
Commits
-------
b6df4e7 Moved ->setDate() before the deprecation handling.
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes#22307).
Discussion
----------
[Debug] Fix php notice
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Of course autoloading of an empty string should not actually happen (fixed that in https://github.com/twigphp/Twig/pull/2438) but if it does happen it should not throw a php notice.
```
Notice: Uninitialized string offset 0
```
Commits
-------
e333a1a [Debug] Fix php notice
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel][FrameworkBundle] Dump container logs in Kernel, to have them also on errors
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Inspecting container failures without the logs is hard, let's have them at hand. This should not be the responsibility of a compiler pass.
Commits
-------
a8b83340bb [HttpKernel][FrameworkBundle] Dump container logs in Kernel, to have them also on errors
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebServerBundle] added a way to dump current status host/port/address when getting the status
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Now that the web server can run on an automatically chosen port, it's more complex to integrate it into tests (I want to run some functional tests locally).
The `server:status` command gives this information, but not in a machine-readable way.
I propose to add a `--filter` flag to fix that:
`./bin/console server:status --filter=address`
Commits
-------
b417b62a92 [WebServerBundle] added a way to dump current status host/port/address when getting the status
This PR was merged into the 3.3-dev branch.
Discussion
----------
[BC BREAK][DI] Always autowire "by id" instead of using reflection against all existing services
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes - compile time only
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
(patch best reviewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/22295/files?w=1).)
"By-id" autowiring, as introduced in #22060 is free from all the issues that "by-type" autowiring has:
- it has no magic and requires explicit type<>id matching (*vs* using reflection on all services to cherry-pick *the* one that matches some type-hint *at that time*, which is fragile)
- it is free from any ambiguities (*vs* the Damocles' sword of breaking config just by enabling some unrelated bundle)
- it is easily introspected: just look at DI config files (*vs* inspecting the type-hierarchy of all services + their type-hints)
- ~~it is side-effect free, thus plain predictable (*vs* auto-registration of discovered types as services)~~
- it plays nice with deprecated services or classes (see #22282)
- *etc.*
Another consideration is that any "by-type" autowired configuration is either broken (because of future ambiguities) - or equivalent to a "by-id" configuration (because resolving ambiguities *means* adding explicit type<>id mappings.) For theoreticians, we could say that "by-id" autowiring is the asymptotic limit of "by-type" autowiring :-)
For all these reasons - and also because it reduces the complexity of the code base - I propose to change the behavior and only support "by-id" autowiring in 3.3. This will break some configurations relying on "by-type" autowiring. Yet the break will only happen at compile-time, which means this won't *silently* break any apps. For all core Symfony services, they will work out of the box thanks to #22098 *et al.* For the remaining services, fixing ones config should be pretty straightforward: just follow the suggestions provided by the exception messages. If they are fine to you, you'll end up with the exact same config in the end. And maybe you'll spot issues that were hidden previously.
Commits
-------
cc5e582dcf [BC BREAK][DI] Always autowire "by id" instead of using reflection against all existing services
* 3.2:
move provider after test
update dataProvider function name
cast substr result to string and remove empty function use
rename dataset provider
Add a test to prevent future regressions
Switch to `empty` native function to check emptiness
remove non relevant test case
Switch to `is_string` native method
Remove unnecessary parentheses
Add a test case to prevent future regressions
Move empty condition in return statement
Use LF line separator
fix coding standard to comply with fabbot
Remove malformed EmailValidatorTest + Update UrlValidator test
Add empty check on host in other methods + add unit tests
[Validator] Allow checkMX() to return false when $host is empty
[DI] Prevent AutowirePass from triggering irrelevant deprecations
[DI] Fix the xml schema
[Translation] avoid creating cache files for fallback locales.
* 2.8:
move provider after test
update dataProvider function name
cast substr result to string and remove empty function use
rename dataset provider
Add a test to prevent future regressions
Switch to `empty` native function to check emptiness
remove non relevant test case
Switch to `is_string` native method
Remove unnecessary parentheses
Add a test case to prevent future regressions
Move empty condition in return statement
Use LF line separator
fix coding standard to comply with fabbot
Remove malformed EmailValidatorTest + Update UrlValidator test
Add empty check on host in other methods + add unit tests
[Validator] Allow checkMX() to return false when $host is empty
[DI] Prevent AutowirePass from triggering irrelevant deprecations
[DI] Fix the xml schema
[Translation] avoid creating cache files for fallback locales.
* 2.7:
move provider after test
update dataProvider function name
cast substr result to string and remove empty function use
rename dataset provider
Add a test to prevent future regressions
Switch to `empty` native function to check emptiness
remove non relevant test case
Switch to `is_string` native method
Remove unnecessary parentheses
Add a test case to prevent future regressions
Move empty condition in return statement
Use LF line separator
fix coding standard to comply with fabbot
Remove malformed EmailValidatorTest + Update UrlValidator test
Add empty check on host in other methods + add unit tests
[Validator] Allow checkMX() to return false when $host is empty
[DI] Fix the xml schema
[Translation] avoid creating cache files for fallback locales.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Form] Deprecated usage of "choices" option in sub types
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | ~
Follows #21880 and the discussion in #20771.
Commits
-------
b5b56fcbac [Form] Deprecated usage of "choices" option in sub types
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] report deprecations when linting YAML files
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
In a project I frequently discovered usages of deprecated YAML formats. I first wanted to set up a build step that would lint all YAML files found in that project to be able to report it inside the CI. While doing so I noticed that the lint command was ignoring all deprecations after all. I suggest that catch all deprecations triggered by the YAML components and turn them into reported errors here. If we think that this could be seen as misbehaviour as the Symfony YAML parser is still able to handle these files properly, we could think about adding an additional option to the command that would turn on the deprecation handling.
Commits
-------
9b4206ff73 report deprecations when linting YAML files
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI/Yaml] Remove `@experimental` flag from "instanceof" and "prototype"
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We don't need this flag on these features: the implementation is stable, and regular deprecations should be the way to go in the event where we decide to remove this later on.
That would leave only one single `@experimental` feature in 3.3: `CacheItem::getPreviousTags()`, which looks legitimate to me (since this method is aiming at interop).
Commits
-------
e8723df28a [DI/Yaml] Remove `@experimental` flag from "instanceof" and "prototype"
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebProfiler] Fix race condition in fast Ajax requests
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22297
| License | MIT
Patch `startAjaxRequest` and `finishAjaxRequest` functions to absolute noop in case the debug toolbar itself is not loaded yet, and spool historic requests after the toolbar is loaded.
Commits
-------
538a59254f [WebProfiler] Fix race condition in fast Ajax requests
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Allow to catch CommandNotFoundException
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22144#issuecomment-289200937
| License | MIT
| Doc PR | n/a
Basically reverts #22144, making the command argument optional in console.error event instead, so that `CommandNotFoundException` can be handled as any other console error.
Commits
-------
b21ce850e7 [Console] Allow to catch CommandNotFoundException
This PR was merged into the 2.8 branch.
Discussion
----------
[DI] Prevent AutowirePass from triggering irrelevant deprecations
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no (just a failing test case atm)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
For populating available types the AutowirePass iterates over `$container->getDefinitions()` trying to instantiate a reflection class for each definition.
Problem is that if one of these classes is deprecated, a notice is triggered due to the reflection, even if the service is actually never used.
~~Right now this only reproduces the issue with a failing test case~~, this bug (if we agree it's a bug) breaks the test suite of a bundle I maintain (see https://travis-ci.org/lexik/LexikJWTAuthenticationBundle/jobs/218275650#L262)
Solutions I can think about for now:
- ~~Skip deprecated definitions from type registering, meaning that if a service is deprecated a day, all autowired services that rely on it will suddenly be broken, also the bug would remain if the definition is not deprecated but relies on a deprecated class, not good I think~~
- Register an error handler ignoring deprecations during the type registering process (`AutowirePass#populateAvailableType()`), ~~works but makes my test suite say `THE ERROR HANDLER HAS CHANGED`. I'll push my try as a 2nd commit.~~
Thoughts?
Commits
-------
77927f4b33 [DI] Prevent AutowirePass from triggering irrelevant deprecations
This PR was merged into the 3.3-dev branch.
Discussion
----------
Bump monolog to 1.19 and use the agent regex const from parent
See #22264
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | refer to #22264
| License | MIT
| Doc PR |
Bump monolog and use const from parent. See https://github.com/symfony/symfony/issues/22264#issuecomment-291524038
I went for `static` instead of `self` in case anyone wanted to easily override just the agent string.
Commits
-------
69f9586fd5 Bump monolog to 1.19 and use the agent regex const from parent, see #22264
* 3.2:
bumped Symfony version to 3.2.8
updated VERSION for 3.2.7
updated CHANGELOG for 3.2.7
Fixes#22264 - add support for Chrome headless, see also Seldaek/monolog#966
[Workflow] update documentation URL in readme
bumped Symfony version to 2.8.20
updated VERSION for 2.8.19
updated CHANGELOG for 2.8.19
Dont call sprintf() when no placeholders are used
* 2.8:
Fixes#22264 - add support for Chrome headless, see also Seldaek/monolog#966
bumped Symfony version to 2.8.20
updated VERSION for 2.8.19
updated CHANGELOG for 2.8.19
Dont call sprintf() when no placeholders are used
Patch startAjaxRequest and finishAjaxRequest functions to absolute noop
in case the debug toolbar itself is not loaded yet, and spool historic
requests after the toolbar is loaded.
Fixes#22297
This PR was squashed before being merged into the 3.3-dev branch (closes#22279).
Discussion
----------
[DI] Fix anonymous factories/configurators support
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21999#discussion_r106019873
| License | MIT
| Doc PR |
Using prototypes / instanceof conditionals, anonymous factories are inlined using `Definition`, so a new instance will be created for every service created from the prototype / conditional which is inconsistent with the way other anonymous services are managed.
Commits
-------
dda43ed8ce [DI] Fix anonymous factories/configurators support
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Use IteratorArgument for voters
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| License | MIT
Use an IteratorArgument for injecting voters into the AccessDecisionManager.
Commits
-------
4ec80b1ae8 Use IteratorArgument for voters
* 3.2:
[FrameworkBundle] Update console fixtures after #22217
Allow Upper Case property names
fix some risky tests
bumped Symfony version to 2.7.27
updated VERSION for 2.7.26
update CONTRIBUTORS for 2.7.26
updated CHANGELOG for 2.7.26
This PR was squashed before being merged into the 2.8 branch (closes#22278).
Discussion
----------
[FrameworkBundle] Update console fixtures after #22217
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes (regression from #22217)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22217#issuecomment-291497513
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
cc @fabpot
Sorry for the inconvenience :)
Commits
-------
6e1cee6 [FrameworkBundle] Update console fixtures after #22217
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add "factory" support to named args and autowiring
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
To me, factories are expected to work named arguments.
Doing so also unlocks supporting them when autowiring, and will benefit #22187 soon.
Commits
-------
27470de62a [DI] Add "factory" support to named args and autowiring
* 2.8:
Allow Upper Case property names
fix some risky tests
bumped Symfony version to 2.7.27
updated VERSION for 2.7.26
update CONTRIBUTORS for 2.7.26
updated CHANGELOG for 2.7.26
This PR was merged into the 2.7 branch.
Discussion
----------
fix some more risky tests
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Continuation of #22066 fixing the tests for the following components:
* Config
* Form
* HttpFoundation
* Security
Commits
-------
fffcd247b2 fix some risky tests
ReflectionExtractor::getProperties() returns $id instead of $Id. It is bad naming convention, but is possible
```
class Entity {
protected $Id;
public function getId()
{
return $this->Id;
}
}
```
# Conflicts:
# src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php
# src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Give errors back to error handler if not handled by console.error listeners
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22259
| License | MIT
| Doc PR | n/a
Re-throws errors if `ConsoleErrorEvent::markErrorAsHandled()` hasn't been called so that they can reach the global error handler, fixing the BC break.
Commits
-------
5a5bf54d37 [Console] Give errors back to error handlers if not handled by console.error listeners
This PR was squashed before being merged into the 3.2 branch (closes#22270).
Discussion
----------
[Console] Fix render exception test
| Q | A
| ------------- | ---
| Branch? | 3.2 and up
| Bug fix? | yes (regression from #22188 in master)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22217#issuecomment-291437500
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
As pointed out by @chalasr tests are mysteriously broken.. not sure what i missed but this is apparently needed now..
cc @fabpot
Commits
-------
6b71722392 [Console] Fix render exception test
* 3.2:
[DI] Autowiring and factories are incompatible with each others
[DI] Don't use auto-registered services to populate type-candidates
Lighten tests output by removing composer suggestions
support nullable array or collection
Complete the injection of the expression in all syntax errors
CS: Remove invisible chars
Disable resource tracking if the config component is missing
[EventDispatcher] Remove unneded count()
Fix tests expecting a valid date
Avoid forcing to define the choices_as_values option when using choice_loader
add expression text to SyntaxError
[Console] Fix table cell styling
[Console] Revised exception rendering
Fix @param in PHPDoc
[WebProfilerBundle] Normalize whitespace in exceptions passed in headers
Disable color support detection for tests
[Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set
* 2.8:
[DI] Autowiring and factories are incompatible with each others
[DI] Don't use auto-registered services to populate type-candidates
Lighten tests output by removing composer suggestions
support nullable array or collection
Complete the injection of the expression in all syntax errors
CS: Remove invisible chars
Disable resource tracking if the config component is missing
[EventDispatcher] Remove unneded count()
Fix tests expecting a valid date
Avoid forcing to define the choices_as_values option when using choice_loader
add expression text to SyntaxError
[Console] Fix table cell styling
[Console] Revised exception rendering
[WebProfilerBundle] Normalize whitespace in exceptions passed in headers
Disable color support detection for tests
[Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set
This PR was merged into the 3.3-dev branch.
Discussion
----------
Fix HttpCache test
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | https://github.com/symfony/symfony/pull/22043#discussion_r107864054
| License | MIT
| Doc PR | n/a
will make appveyor green.
Commits
-------
3178f50594 Fix failing HttpCache test on windows
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] add ServiceLocatorTagPass::register() to share service locators
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Right now, one service locator is created per controller / service subscriber. But since service locators are stateless, this is just wasting resources when several controllers have the exact same set of services managed by their locators (as would be the case when registering the new `AbstractController` as a service subscribers).
This PR fixes this issue, and a few related others found along the way.
Commits
-------
8ff764be82 [DI] add ServiceLocatorTagPass::register() to share service locators
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Dont trigger deprecation for event_dispatcher service
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22208
| License | MIT
| Doc PR | n/a
Mute deprecations for the event_dispatcher service keeping only relevant ones i.e when the api of the deprecated class is used intentionally, ugly but prevent breaking test suites like the [LexikJWTAuthenticationBundle one](https://travis-ci.org/lexik/LexikJWTAuthenticationBundle/jobs/216664013#L278).
Commits
-------
a49fe25fa3 [DI] Dont trigger deprecation for event_dispatcher service
This PR was merged into the 2.8 branch.
Discussion
----------
[DI] Autowiring and factories are incompatible with each others
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
9b601633a7 [DI] Autowiring and factories are incompatible with each others
This PR was merged into the 2.8 branch.
Discussion
----------
[DI] Don't use auto-registered services to populate type-candidates
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no (every bug fix is a bc break, isn't it?)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22162, ~~#21658~~
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
Alternative to #22170 and ~~#21665~~.
The core issue fixed here is that auto-registered services should *not* be used as type-candidates.
The culprit is this line:
`$this->populateAvailableType($argumentId, $argumentDefinition);`
Doing so creates a series of wtf-issues (the linked ones), with no simple fixes (the linked PRs are just dealing with the simplest cases, but the real fix would require a reboot of autowiring for every newly discovered types.)
The other changes accommodate for the removal of the population of the `types` property, and fix a few other issues found along the way:
- variadic constructors
- empty strings injection
- tail args removal when they match the existing defaults
Commits
-------
992c677534 [DI] Don't use auto-registered services to populate type-candidates
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Serializer][XmlEncoder] Added a FORMAT constant
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Added a FORMAT constant in the XmlEncoder class to normalize it like other Encoder classes.
Commits
-------
0a0901b8bc [Serializer] Added a FORMAT constant in the XmlEncoder class
This PR was merged into the 2.7 branch.
Discussion
----------
[ExpressionLanguage] Provide the expression in syntax errors
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #19445
| License | MIT
| Doc PR | n/a
This finishes the PR #19449.
Commits
-------
7cd744133d Complete the injection of the expression in all syntax errors
dc55db2a9d add expression text to SyntaxError
This PR was merged into the 2.8 branch.
Discussion
----------
[PropertyInfo] Support nullable array or collection
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22248
| License | MIT
| Doc PR |
`@var array|null` was always considered as not nullable in the `PhpDocExtractor`.
Commits
-------
74ee588924 support nullable array or collection
* 2.7:
Lighten tests output by removing composer suggestions
CS: Remove invisible chars
Disable resource tracking if the config component is missing
[EventDispatcher] Remove unneded count()
Fix tests expecting a valid date
[Console] Fix table cell styling
[Console] Revised exception rendering
[WebProfilerBundle] Normalize whitespace in exceptions passed in headers
Disable color support detection for tests
[Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Workflow] Added 'workflow_marked_places' twig function
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
When someone uses a custom MarkingStore, the value in the
$subject::marking can be really different from the value inside
Marking::getPlaces(). This occurs, for example, when the value stored in
the subject is a bit mask.
So it's always safer to get the places names from the marking, and so
with this new function.
---
usage:
```twig
{{ workflow_marked_places(post)|join(',') }}
```
Commits
-------
ead6f142bb [Workflow] Added 'workflow_marked_places' twig function
This PR was squashed before being merged into the 2.7 branch (closes#22232).
Discussion
----------
CS: Remove invisible chars
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | n/a
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
I found out that we have 2 non-visible in regular IDE chars in codebase.
One is just inside a comment, it could be safely removed.
But second is inside a real code, I have replaced it with `pack`, so one won't accidentally replace non-breaking space with regular space.
Commits
-------
0f623f4 CS: Remove invisible chars
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22171, silexphp/Silex#1496
| License | MIT
| Doc PR | -
Implementing `ServiceSubscriberInterface` creates a dep on the DI component, which Silex can't afford. Let's revert that part.
@GromNaN can you please confirm this fixes your issue?
Commits
-------
7cd90f5c97 [HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener
This PR was merged into the 2.7 branch.
Discussion
----------
[Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22103
| License | MIT
| Doc PR | -
Commits
-------
ef39b704cc [Form] Improve the exceptions when trying to get the data in a PRE_SET_DATA listener and the data has not already been set
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Fix table cell styling
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | tiny one
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
Fixes an issue with newlines and table cells. Remembered this little trick from @chalasr as we had it before with style blocks i believe..
```php
$table = new Table($output);
$table->setRows(array(
array(new TableCell('<error>Dont break'."\n".'here</error>', array('colspan' => 2))),
new TableSeparator(),
array('foo', new TableCell('<error>Dont break'."\n".'here</error>', array('rowspan' => 2))),
array('bar'),
));
$table->render();
```
Before
![image](https://cloud.githubusercontent.com/assets/1047696/24467857/74dacc9e-14b6-11e7-8f62-3831508ac949.png)
After
![image](https://cloud.githubusercontent.com/assets/1047696/24467923/bb578f0e-14b6-11e7-85ed-039cd73b81a0.png)
Commits
-------
53ecf8393e [Console] Fix table cell styling
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Component] [Yaml] [Parser] : can parse with trailing space as 2.8
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | #22193
| License | MIT
| Doc PR | symfony/symfony-docs
Missing rtrim method in line to parse as the version 2.8 does
Commits
-------
ce3d5ab7d1 [Component] [Yaml] [Parser] : can parse with trailing space as 2.8
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] CommandTester: disable color support detection
| 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 | -
By default, the command tester relies on [color support guessing](3fe419cf66/src/Symfony/Component/Console/Output/StreamOutput.php (L91)) to enable output decoration.
This is an issue for tests in that guessing is done against the stream instance on Linux and against the actual environment running the test on Windows, so color support can be detected on Windows even when the used stream is a memory stream like here, resulting in non-deterministic tests.
This PR disables output decoration by default. This will only change behavior on Windows with color support, as guessing on Linux always detects color as not supported for memory streams anyway. Tests should enable decoration explicitly when they want to test it.
A better fix would be to actually detect that we are using a memory stream on Windows as well, but I'm not sure it's possible.
Commits
-------
3fe419cf66 Disable color support detection for tests
When using the choice loader, choices are ignored entirely. Forcing the dev
to add the choices_as_values just to avoid the deprecation warning (and then
to remove the option again at some point in 3.x due to deprecation) is a bad
developer experience.
When someone uses a custom MarkingStore, the value in the
$subject::marking can be really different from the value inside
Marking::getPlaces(). This occurs, for example, when the value stored in
the subject is a bit mask.
So it's always safer to get the places names from the marking, and so
with this new function.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Throw on "configured-keys <> getSubscribedServices()" mismatch
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
As reported on Slack, this creates DX issues, and provides no practical benefit. Let's throw instead of logging.
Commits
-------
4da8884ca4 [DI] Throw on "configured-keys <> getSubscribedServices()" mismatch
This PR was merged into the 2.7 branch.
Discussion
----------
[WebProfilerBundle] Normalize whitespace in exceptions passed in headers
| Q | A
| ------------- | ---
| Branch? | 2.7 upwards
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22072
| License | MIT
If an exception was thrown with line separators in its message the WebProfiler would cause an exception by passing it through unsanitized into the X-Debug-Error HTTP header. This commit fixes that by replacing all whitespace sequences with a single space in the header.
Commits
-------
d64679014b [WebProfilerBundle] Normalize whitespace in exceptions passed in headers
Errors reported by Sami API Doc generator on branch 3.2
ERROR: The "factory" @param tag variable name is wrong (should be "objectLoader") on "Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader::__construct" in src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php:68
ERROR: The "objectLoader" @param tag variable name is wrong (should be "factory") on "Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader::__construct" in src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php:68
ERROR: "7" @param tags are expected but only "6" found on "Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController::__construct" in src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php:50
ERROR: "3" @param tags are expected but only "2" found on "Symfony\Component\Asset\PathPackage::__construct" in src/Symfony/Component/Asset/PathPackage.php:35
ERROR: "2" @param tags are expected but only "1" found on "Symfony\Component\Cache\Adapter\PhpArrayAdapter::create" in src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php:64
ERROR: "3" @param tags are expected but only "1" found on "Symfony\Component\Cache\Adapter\RedisAdapter::__construct" in src/Symfony/Component/Cache/Adapter/RedisAdapter.php:39
ERROR: The "format" @param tag variable name is wrong (should be "fileLinkFormat") on "Symfony\Component\Debug\ExceptionHandler::setFileLinkFormat" in src/Symfony/Component/Debug/ExceptionHandler.php:90
ERROR: "2" @param tags are expected but only "3" found on "Symfony\Component\DependencyInjection\Compiler\Compiler::addPass" in src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:73
ERROR: "2" @param tags are expected but only "3" found on "Symfony\Component\DependencyInjection\Compiler\PassConfig::addPass" in src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php:97
ERROR: "2" @param tags are expected but only "3" found on "Symfony\Component\DependencyInjection\ContainerBuilder::addCompilerPass" in src/Symfony/Component/DependencyInjection/ContainerBuilder.php:311
ERROR: "2" @param tags are expected but only "3" found on "Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface::getProxyFactoryCode" in src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php:41
ERROR: "0" @param tags are expected but only "1" found on "Symfony\Component\HttpFoundation\Request::isMethodSafe" in src/Symfony/Component/HttpFoundation/Request.php:1458
ERROR: "5" @param tags are expected but only "6" found on "Symfony\Component\Serializer\Normalizer\AbstractNormalizer::instantiateObject" in src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php:291
If an exception was thrown with line separators in its message the
WebProfiler would cause an exception by passing it through unsanitized
into the X-Debug-Error HTTP header. This commit fixes that by replacing
all whitespace sequences with a single space in the header.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Enhance DX by throwing instead of triggering a deprecation notice
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes - at the config file level, for edge cases
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22143
| License | MIT
| Doc PR | -
Looking at the linked issue, I'm reconsidering our decision to trigger a deprecation notice when one uses `_instanceof` or `_defaults` as a service name. While on the BC side, this is strict - on the DX side, it looks like this opens a trap where people fill fall into.
The same occurs to me with named args: instead of silently accepting invalid args as was the case before, let's throw to help DX when people do mistakes.
Last change in this PR: the complex logic required to force strings to be given as `$id` args into `Reference` or `Alias` makes no sense to me, especially considering that a `string` type hint on PHP7 will *do* a string cast.
Commits
-------
b07da3d [DI] Enhance DX by throwing instead of triggering a deprecation notice
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpKernel] Fix test
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Should make 2.7 green again on Travis.
Commits
-------
ba8f46ad23 [HttpKernel] Fix test
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Escape exception messages in renderException
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22021
| License | MIT
| Doc PR | n/a
Adding style on exception messages should be prevented, it leads to weird results.
> Allowing formatting in them would be a nightmare, given that Symfony itself applies some formatting when rendering the exception.
Commits
-------
cb1348231a [Console] Escape exception messages
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX] [DI] Throw more helpful error when shortcutting global classes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? |no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22146
| License | MIT
As discussed in #22146 the error message received when trying to use a class in the global
namespace as a service without defined class is confusing. Helpful information was added
pointing out this current limitation.
Commits
-------
b9e7b4fd61 [DependencyInjection] Throw helpful error when shortcutting global classes
As discussed in #22146 the error message received when trying to use a class in the global
namespace as a service without defined class is confusing. Helpful information was added
pointing out this current limitation.
* 3.2:
[Bridge\Doctrine] Fix change breaking doctrine-bundle test suite
[WebProfilerBundle] Include badge status in translation tabs
[FrameworkBundle] Cache pool clear command requires at least 1 pool
[HttpFoundation][bugfix] should always be initialized
MockArraySessionStorage: updated phpdoc for $bags so that IDE autocompletion would work
normalize paths before making them relative
removed test that does not test anything
fixed tests
#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
[WebProfilerBundle] Fix for CSS attribute at Profiler Translation Page
Set Date header in Response constructor already
[Validator] fix URL validator to detect non supported chars according to RFC 3986
[Security] Fixed roles serialization on token from user object
* 2.8:
[Bridge\Doctrine] Fix change breaking doctrine-bundle test suite
[HttpFoundation][bugfix] should always be initialized
MockArraySessionStorage: updated phpdoc for $bags so that IDE autocompletion would work
normalize paths before making them relative
* 2.7:
[Bridge\Doctrine] Fix change breaking doctrine-bundle test suite
[HttpFoundation][bugfix] should always be initialized
MockArraySessionStorage: updated phpdoc for $bags so that IDE autocompletion would work
normalize paths before making them relative
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add "by-id" autowiring: a side-effect free variant of it based on the class<>id convention
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR adds a new autowiring mode, based only on the class <> id convention.
This way of autowiring is free from any conflicting behavior, which is what I was looking for to begin with.
The expected DX is a bit more involving than the current way we do autowiring. But it's worth it to me, because it's plain predictable - a lot less "magic" imho.
So in this mode, for each `App\Foo` type hint, a reference to an "App\Foo" service will be created. If no such service exists, an exception will be thrown. To me, this opens a nice DX: when type hinting interfaces (which is the best practice), this will tell you when you need to create the explicit interface <> id mapping that is missing - thus encourage things to be made explicit, but only when required, and gradually, in a way that will favor discoverability by devs.
Of course, this is opt-in, and BC. You'd need to do eg in yaml: `autowire: by_id`.
For consistency, the current mode (`autowire: true`) can be configured using `autowire: by_type`.
Commits
-------
c298f2a90c [DI] Add "by-id" autowiring: a side-effect free variant of it based on the class<>id convention
This PR was merged into the 3.3-dev branch.
Discussion
----------
Revert "feature #20973 [DI] Add getter injection (nicolas-grekas)"
This reverts commit 2183f98f54, reversing
changes made to b465634a55.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no (master only)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Let's remove getter injection, we now have enough alternative mechanisms to achieve almost the same results (e.g. `ServiceSubscriberInterface`, see #21708)., and I'm tired being called by names because of it.
The only use case in core is `ControllerTrait`, but this should be gone if #22157 is merged.
Commits
-------
23fa3a09bf Revert "feature #20973 [DI] Add getter injection (nicolas-grekas)"
This PR was squashed before being merged into the 3.3-dev branch (closes#22046).
Discussion
----------
[Asset] Adding a new version strategy that reads from a manifest JSON file
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/issues/7659
Hi guys!
Often, when using a frontend task manager or bundler (e.g. webpack of gulp), the final assets are dumped with a version or content hash in the filename itself (e.g. main.123abc.css). To know what the correct, current hashed filename is, you'll dump a `manifest.json` file - e.g.
```json
{
"main.js": "main.123abc.js",
"css/styles.css": "css/styles.555def.css"
}
```
Examples: [gulp-rev](https://github.com/sindresorhus/gulp-rev) and [webpack-manifest-plugin](https://www.npmjs.com/package/webpack-manifest-plugin).
This PR adds a new version strategy that will look up the asset path (e.g. `main.css`) in that file and return the final, versioned path. Some people may dump manifest files in other formats, but I think this catches the most common use-case (and you can always still create your own version strategy). I've written this to be "forgiving" - if a path doesn't exist in the manifest, the path is simply returned, unaltered.
Another implementation *could* have been to add a new Twig filter (e.g. `{{ asset('main.css|manifest_path) }}`) - but I thought I'd try first using the existing versioning system.
## Usage
```yml
# app/config/config.yml
framework:
# ...
assets:
# added validation prevents you from setting json_manifest_path AND version, for example
json_manifest_path: '%kernel.root_dir%/../web/manifest.json'
```
```twig
{# someTemplate.html.twig #}
{# use asset() just like normal #}
<script src="{{ asset('js/main.js') }}"></script>
```
## TODO
* fabbot hates my invalid json syntax file... even though I tried to be clever and not give it a `.json` suffix :)
Commits
-------
07fec2bbad [Asset] Adding a new version strategy that reads from a manifest JSON file
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Fixed fatal error when the command is not defined
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/18140/files#r107871406
| License | MIT
| Doc PR |
Commits
-------
d5b41b6b0a [Console] Fixed fatal error when the command is not defined
This PR was merged into the 2.7 branch.
Discussion
----------
[Filesystem] normalize paths before making them relative
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22083
| License | MIT
| Doc PR |
Commits
-------
d50ffa1de7 normalize paths before making them relative
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpFoundation][DX] MockArraySessionStorage: phpdocs update
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Commits
-------
967f7a7add MockArraySessionStorage: updated phpdoc for $bags so that IDE autocompletion would work
* 2.8:
removed test that does not test anything
fixed tests
#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
[WebProfilerBundle] Fix for CSS attribute at Profiler Translation Page
Set Date header in Response constructor already
[Validator] fix URL validator to detect non supported chars according to RFC 3986
[Security] Fixed roles serialization on token from user object
* 2.7:
removed test that does not test anything
fixed tests
#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
[Validator] fix URL validator to detect non supported chars according to RFC 3986
[Security] Fixed roles serialization on token from user object
This PR was squashed before being merged into the 3.3-dev branch (closes#21819).
Discussion
----------
[Twig Bridge] A simpler way to retrieve flash messages
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Getting flash messages in templates is more complex than it could be. Main problems:
1. It's too low level: you need to get the "flash bag" (and first, learn what a "flash bag" is) and then you need to call the internal method: `all()`, `get()`, etc.
2. You need to be careful because the session will start automatically when you ask for flashes (even if there are no flashes). You can prevent this with the `{% if app.session is not null and app.session.started %}` code, but it's boring to always use that.
So, I propose to add a new `app.flashes` helper that works as follows.
---
## Get all the flash messages
### Before
```twig
{% if app.session is not null and app.session.started %}
{% for label, messages in app.session.flashbag.all %}
{% for message in messages %}
<div class="alert alert-{{ label }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
```
### After
```twig
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="alert alert-{{ label }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
```
---
## Get only the flashes of type `notice`
```twig
{% if app.session is not null and app.session.started %}
{% for message in app.session.flashbag.get('notice') %}
<div class="alert alert-notice">
{{ message }}
</div>
{% endfor %}
{% endif %}
```
### After
```twig
{% for message in app.flashes('notice') %}
<div class="alert alert-notice">
{{ message }}
</div>
{% endfor %}
```
---
As an added bonus, you can get any number of flash messages because the method allows to pass an array of flash types:
```twig
{% for label, messages in app.flashes(['warning', 'error']) %}
{% for message in messages %}
<div class="alert alert-{{ label }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
```
Commits
-------
5a56b23327 [Twig Bridge] A simpler way to retrieve flash messages
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX][Form][Validator] Add ability check if cocrete constraint fails.
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | wait for travis |
| Fixed tickets | #15154 |
| License | MIT |
| Doc PR | should open |
Sometimes for big forms with multiple constraints we should handle some errors separately.
``` php
// when using validator
$constraintViolations = $validator->validate(...);
if (count($constraintViolations->findByCodes(UniqueEntity::NOT_UNIQUE_ERROR))) {
// display some message or send email or etc
}
// when using forms
if (count($form->getErrors()->findByCodes(UniqueEntity::NOT_UNIQUE_ERROR))) {
// display some message or send email or etc
}
```
This PR add some useful methods to handle this. Before we should iterate all failed constraints using foreach.
Feel free to suggest better names for new methods.
Commits
-------
29a3a7e0d6 Add ability retrieve errors by their code.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Lock] Adjust lock delay to avoid false error tests
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Adjust the clockDelay to fix tests
This test is here to:
T0.
* Fork A, B, C
T1.
* A acquire Lock then start sleeping for 3*clockDelay
* B start sleeping for 1*clockDelay
* C start sleeping for 1*clockDelay
T2
* B wakeup AND try to acquire lock in wait mode
* C wakeup AND try to acquire lock in non wait mode (lock should be till acquired by A)
T4
* A release Lock
* B acquire lock and release it
At the end, this tests assert than:
* A acquire and delete the lock
* B acquire and delete the lock
* C failed to acquire the lock
The point is, this test is time sensitive, and if the fork is too slow, A, B and C are not synchronized and C is able to acquire Lock.
This PR adjuste clock delay to reduce false failures
Commits
-------
33f2a9a6f7 Adjust lock delay to avoid false error tests
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Add console.ERROR event and deprecate console.EXCEPTION
| Q | A |
| --- | --- |
| Branch | master |
| Bug fix? | yes |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | yes |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | todo |
## The Problem
The current `console.EXCEPTION` event is only dispatched for exceptions during the execution of `Command#execute()`. All other exceptions (e.g. the ones thrown by listeners to events) are catched by the `try ... catch` loop in `Application#doRunCommand()`. This means that there is _no way to override exception handling_.
## The Solution
This PR adds a `console.ERROR` event which has the same scope as the default `try ... catch` loop. This allows to customize all exception handling.
In order to keep BC, a new event was created and `console.EXCEPTION` was deprecated.
Commits
-------
c02a4c9857 Added a console.ERROR event
This PR was squashed before being merged into the 3.3-dev branch (closes#22120).
Discussion
----------
[FrameworkBundle] Multiple services on one Command class
rebased version of #19305
Commits
-------
2b82fcb437 [FrameworkBundle] Multiple services on one Command class
This PR was squashed before being merged into the 3.3-dev branch (closes#22043).
Discussion
----------
Refactor stale-while-revalidate code in HttpCache, add a (first?) test for it
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
I came up with this while trying to hunt a production bug related to handling of stale cache entries under the condition of a busy backend (also see #22033).
It's just a refactoring to make the code more readable plus a new test.
Commits
-------
b14057c88a Refactor stale-while-revalidate code in HttpCache, add a (first?) test for it
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Add new "controller.service_arguments" tag to inject services into actions
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | (no test yet)
| Fixed tickets | -
| License | MIT
| Doc PR | -
Talking with @simensen and @weaverryan, we wondered if we could leverage the `ArgumentResolver` mechanism to make it inject services on demand, using e.g. autowiring.
```php
class PostController
{
public function indexAction(Request $request, PostRepository $postRepository)
{
// PostRepository comes from the container
$postRepository->findAll(); // ...
}
}
```
This PR achieves that, using a new "controller.service_arguments" tag. Typically:
```yaml
services:
AppBundle\Controller\PostController:
autowire: true
tags:
- name: controller.service_arguments
```
It also supports with explicit wiring (thus doesn't necessarily require autowiring if you don't want to use it):
```yaml
services:
AppBundle\Controller\PostController:
tags:
- name: controller.service_arguments
action: fooAction
argument: logger
id: my_logger
```
~~The attached diff is bigger than strictly required for now, until #21770 is merged.~~
Todo:
- [x] rebase on top of #21770 when merged
- [x] add tests
- [x] add cleaning pass to remove empty service locators
Commits
-------
9c6e672780 [FrameworkBundle] Add new "controller.service_arguments" tag to inject services into actions
This PR was merged into the 3.3-dev branch.
Discussion
----------
[lock] Rename Quorum into Strategy
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes (not consistent naming)
| New feature? | no
| BC breaks? | yes (but version 3.4 not yet released)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR |
The term `Quorum` in Interface is confusing an not consistent with the Symfony project.
This PR switch to naming `Strategy\StrategyInterface` (like in adapter i `Cache` and `Ldap` component)
Commits
-------
1e9671b993 Rename Quorum into Strategy
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Lock] Don't call blindly the redis client
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Actual code rely on controls on the constructor. This PR add an assertion to avoid futur bugs
Commits
-------
e4db018b6d Don't call blindly the redis client
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] Fixed roles serialization on token from user object
| Q | A |
| --- | --- |
| Branch? | 2.7 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #14274 |
| License | MIT |
| Doc PR | - |
This PR fixes the serialization of tokens when using `Role` objects provided from the user. Indeed, there were actually a reference issue that can causes fatal errors like the following one:
```
FatalErrorException in RoleHierarchy.php line 43:
Error: Call to a member function getRole() on string
```
Here is a small code example to reproduce and its output:
``` php
$user = new Symfony\Component\Security\Core\User\User('name', 'password', [
new Symfony\Component\Security\Core\Role\Role('name')
]);
$token = new Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken($user, 'password', 'providerKey', $user->getRoles());
$serialized = serialize($token);
$unserialized = unserialize($serialized);
var_dump($unserialized->getRoles());
```
Before:
```
array(1) { [0]=> bool(true) }
```
After:
```
array(1) { [0]=> object(Symfony\Component\Security\Core\Role\Role)#15 (1) {["role":"Symfony\Component\Security\Core\Role\Role":private]=> string(4) "name" } }
```
Thank you
Commits
-------
dfa7f5020e [Security] Fixed roles serialization on token from user object
* 3.2:
Fixed pathinfo calculation for requests starting with a question mark.
[HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header
[Validator] Add object handling of invalid constraints in Composite
[WebProfilerBundle] Remove uneeded directive in the form collector styles
removed usage of $that
HttpCache: New test for revalidating responses with an expired TTL
[Serializer] [XML] Ignore Process Instruction
[Security] simplify the SwitchUserListenerTest
Revert "bug #21841 [Console] Do not squash input changes made from console.command event (chalasr)"
[HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security][SecurityBundle] Enhance automatic logout url generation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
This should help whenever:
- [the token does not implement the `getProviderKey` method](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php#L89-L99)
- you've got multiple firewalls sharing a same context but a logout listener only define on one of them.
##### Behavior:
> When not providing the firewall key:
>
>- Try to find the key from the token (unless it's an anonymous token)
>- If found, try to get the listener from the key. If the listener is found, stop there.
>- Try from the injected firewall key. If the listener is found, stop there.
>- Try from the injected firewall context. If the listener is found, stop there.
>
>The behavior remains unchanged when providing explicitly the firewall key. No fallback.
Commits
-------
5b7fe852aa [Security][SecurityBundle] Enhance automatic logout url generation
This PR was squashed before being merged into the 3.3-dev branch (closes#22112).
Discussion
----------
Minor PR fixes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes-ish
| New feature? | no
| 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-->
cc @fabpot my bad :)
Commits
-------
0728fb91b8 typo
036b0414d6 Minor PR fixes
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebProfilerBundle] Improved cookie traffic
| Q | A
| ------------- | ---
| Branch? | "master"
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License | MIT
| Doc PR | reference to the documentation PR, if any
![image](https://cloud.githubusercontent.com/assets/1047696/20455635/a033a814-ae60-11e6-8500-e60146f4619e.png)
Relates to #20569 in terms of getting _all_ the cookies.
Commits
-------
171c6d100e [WebProfilerBundle] Improved cookie traffic
This PR was squashed before being merged into the 2.8 branch (closes#22036).
Discussion
----------
Set Date header in Response constructor already
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Setting the `Date` header in the `Response` constructor has been removed in #14912 and changed to a more lazy approach in `getDate()`.
That way, methods like `getAge()`, `getTtl()` or `isFresh()` cause side effects as they eventually call `getDate()` and the Request "starts to age" once you call them.
I don't know if this would be a nice test, but current behaviour is
```php
$response = new Response();
$response->setSharedMaxAge(10);
sleep(20);
$this->assertTrue($response->isFresh());
sleep(5);
$this->assertTrue($response->isFresh());
sleep(5);
$this->assertFalse($response->isFresh());
```
A particular weird case is the `isCacheable()` method, because it calls `isFresh()` only under certain conditions, like particular status codes, no `ETag` present etc. This symptom is also described under "Cause of the problem" in #19390, however the problem is worked around there in other ways.
So, this PR suggests to effectively revert #14912.
Additionally, I'd like to suggest to move this special handling of the `Date` header into the `ResponseHeaderBag`. If the `ResponseHeaderBag` guards that we always have the `Date`, we would not need special logic in `sendHeaders()` and could also take care of https://github.com/symfony/symfony/pull/14912#issuecomment-110105215.
Commits
-------
3a7fa7ede2 Set Date header in Response constructor already
This PR was squashed before being merged into the 3.3-dev branch (closes#19887).
Discussion
----------
Sort alternatives alphabetically when a command is not found
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #10893 |
| License | MIT |
| Doc PR | - |
Commits
-------
ba6c9464ea Sort commands like a human would do
f04b1bd72f Sort alternatives alphabetically when a command is not found
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] json auth listener should not produce a 500 response on bad request format
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
To me, it looks wrong to simply throw a `BadCredentialsException` in the wild, which produces a 500 (unless an entrypoint handles it, which you probably don't have on a json login firewall). There isn't any server error, the client request originated the error due to a wrong format.
Instead, the listener should give a chance to the failure handler to resolve it, and return a proper 4XX response. (BTW, the `UsernamePasswordFormAuthenticationListener` also throws a similar `BadCredentialsException` on a too long submitted username, which is caught and forwarded to the failure handler)
Better diff: https://github.com/symfony/symfony/pull/22034/files?w=1
BTW, should we have another exception type like `BadCredentialsFormatException` or whatever in order to distinct a proper `BadCredentialsException` from a format issue in a failure listener?
Commits
-------
cb175a41c3 [Security] json auth listener should not produce a 500 response on bad request format
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] simplify the SwitchUserListenerTest
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
While working on #22048 I noticed that the `SwitchUserListenerTest` was more complicated than necessary by mocking a lot of stuff that didn't need to be mocked.
Commits
-------
923bbdbf9f [Security] simplify the SwitchUserListenerTest
This PR was squashed before being merged into the 3.3-dev branch (closes#20885).
Discussion
----------
[Console] Option to disable stty
| Q | A
| ------------- | ---
| Branch? |
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? |
| Fixed tickets |
| License | MIT
| Doc PR | reference to the documentation PR, if any
Shall fix problems in Windows based environments if e.g. git is installed and stty is therefore found but writes only cryptic rubbish into the cmd. In the case of console questions it is also possible that input can't be read properly by console component.
Commits
-------
a189a6c52e [Console] Option to disable stty
* 2.8:
[HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header
[Validator] Add object handling of invalid constraints in Composite
[WebProfilerBundle] Remove uneeded directive in the form collector styles
Revert "bug #21841 [Console] Do not squash input changes made from console.command event (chalasr)"
[HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST
This PR was merged into the 2.8 branch.
Discussion
----------
[HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We're missing handling of for/host/proto info embedded in the `Forwarded` header, as eg in:
`Forwarded: for=1.1.1.1:443, host=foo.example.com:1234, proto=https, for=2.2.2.2, host=real.example.com:8080`
Commits
-------
04caacb757 [HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header
This PR was squashed before being merged into the 2.7 branch (closes#21968).
Discussion
----------
Fixed pathinfo calculation for requests starting with a question mark.
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21967
| License | MIT
| Doc PR |
With improper `strpos` result check calculated pathinfo for requests starting with '?' equals to request itself.
Correct pathinfo for those requests should be '/'.
Commits
-------
43297b45de Fixed pathinfo calculation for requests starting with a question mark.
This PR was merged into the 2.8 branch.
Discussion
----------
Revert "bug #21841 [Console] Do not squash input changes made from console.command event (chalasr)"
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21953, https://github.com/symfony/symfony/issues/22050
| License | MIT
| Doc PR | n/a
A bit frustrated to revert this change since the BC break report lacks of information, making us unable to reproduce nor to look at improving the situation.
I'm going to re-propose this on master, covering the BC break that is identified, fixed and tested using the changes made in #21953. That will let the choice for the reporter to upgrade using the 1 required LOC.
Commits
-------
5af47c40dc Revert "bug #21841 [Console] Do not squash input changes made from console.command event (chalasr)"
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Added about command
| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |
![image](https://cloud.githubusercontent.com/assets/1047696/24218101/50c4ebe2-0f42-11e7-985d-b47fc8a6f520.png)
Commits
-------
2550eab43c [FrameworkBundle] Added about command
* 2.7:
[Validator] Add object handling of invalid constraints in Composite
[HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST
| 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 | -
The first "host" in the list provided by `X_FORWARDED_HOST` should be the one, not the last.
Already the case for "port" and "scheme".
Commits
-------
9a2b2de64f [HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST
This PR was squashed before being merged into the 3.3-dev branch (closes#21926).
Discussion
----------
[Routing] Optimised dumped matcher
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
TL;DR: I've optimised the PhpMatcherDumper output for a <del>60x</del> 4.4x performance improvement on a collection of ~800 routes by inducing cyclomatic complexity.
[EDIT] The 60x performance boost was only visible when profiling with blackfire, which is quite possibly a result of the cost of profiling playing a part. After doing some more profiling the realistic benefit of the optimisation is more likely to be in the ranges is 1.3x to 4.4x.
After the previous optimisation I began looking at how the PrefixCollection was adding its performance boost. I spotted another way to do this, which has the same theory behind it (excluding groups based on prefixes). The current implementation only groups when one prefix resides in the other. In this new implementation I've created a way to detect common prefixes, which allows for much more efficient grouping. Every time a route is added to the group it'll either merge into an existing group, merge into a new group with a route that has a common prefix, or merge into a new group with an existing group that has a common prefix.
However, when a parameter is present grouping must only be done AFTER that route, this case is accounted for. In all other cases, where there's no collision routes can be grouped freely because if a group was matched other groups wouldn't have matched.
After all the groups are created the groups are optimised. Groups with fewer than 3 children are inlined into the parent group. This is because a group with 2 children would potentially result in 3 prefix checks while if they are inlines it's 2 checks.
Like with the previous optimisation I've profiled this using blackfire. But the match function didn't show up anymore. I've added `usleep` calls in the dumped matcher during profiling, which made it show up again. I've verified with @simensen that this is because the wall time of the function was too small for it to be of any interest. When it DID get detected, because of more tasks running, it would show up with around 250 nanoseconds. In comparison, the previous speed improvement brought the wall time down from 7ms to ~2.5ms on a set of ~800 routes.
Because of the altered grouping behaviour I've not modified the PrefixCollection but I've created a new StaticPrefixCollection and updated the PhpMatcherDumper to use that instead.
Commits
-------
449b6912dc [Routing] Optimised dumped matcher
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] ParseException: pcre.backtrack_limit reached
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
while merging 3.2 into master, I noticed that `testCanParseVeryLongValue` is triggering this error on master, due to this regexp that we added for handling yaml tags. This regexp needs to be fixed so that we can merge the test case.
ping @GuilhemN
Commits
-------
f0256f1aa5 [Yaml] Fix pcre.backtrack_limit reached
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Serializer] Add option to register a circular_reference_handler
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
Right now, it's quite hard (especially for new comers) to register a CircularReferenceHandler:
![screenshot1](https://cloud.githubusercontent.com/assets/408368/23959193/ce19bcec-09a4-11e7-82c7-80abd7b7f602.png)
---
This PR introduce an option to wire a service to the internal Object Normalizer.
Commits
-------
0a638f5352 [FrameworkBundle][Serializer] Add option to register a "circular_reference_handler"
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Deprecate Container::isFrozen and introduce isCompiled
| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | yes |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |
This deprecates the concept of freezing a container, implied by `Container::isFrozen`. However, freezing happens due compilation (`Container::compile`). So having just `isCompiled` instead seems more intuitive, and plays along well with `ContainerBuilder`.
Before/After;
- `Container::isFrozen`
- Checks if the parameter bag is frozen, but is deprecated in 3.2
- In 4.0 this methods does not exists and can be replaced with `getParameterBag() instanceof FrozenParameterBag` _or_ `isCompiled()`. Depending on what you want (to clarify; the behavior is different when passing a frozen bag to the constructor)
- `Container::isCompiled`
- Truly checks if `compile()` has ran, and is a new feature
- `ContainerBuilder::merge` etc.
- Now uses `isCompiled` instead of `isFrozen`, ie. we allow for it till compilation regarding the state of the paramater bag
Commits
-------
6abd312800 [DI] Deprecate Container::isFrozen and introduce isCompiled
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Exclude empty namespaces in text descriptor
| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |
Before:
```
$ bin/console
doctrine
doctrine:mapping:convert [orm:convert:mapping] Convert mapping information between supported formats.
orm <----
router
router:match Helps debug routes by simulating a path info match
$ bin/console list orm
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: max(): Array must contain at least one element
$ bin/console list generate
Available commands for the "generate" namespace:
generate:bundle Generates a bundle
generate:command Generates a console command
generate:controller Generates a controller
```
After:
```
$ bin/console
doctrine
doctrine:mapping:convert [orm:convert:mapping] Convert mapping information between supported formats.
router
router:match Helps debug routes by simulating a path info match
$ bin/console list orm
Available commands for the "orm" namespace:
orm:convert:mapping Convert mapping information between supported formats.
$ bin/console list generate
Available commands for the "generate" namespace:
generate:bundle Generates a bundle
generate:command Generates a console command
generate:controller Generates a controller
generate:doctrine:crud Generates a CRUD based on a Doctrine entity
generate:doctrine:entities Generates entity classes and method stubs from your mapping information
generate:doctrine:entity Generates a new Doctrine entity inside a bundle
generate:doctrine:form Generates a form type class based on a Doctrine entity
```
Overrules #19776 but also includes other fixes related to aliases that popped up when writing tests 👍
Commits
-------
d5a7608036 [Console] Exclude empty namespaces in text descriptor
This PR was squashed before being merged into the 3.3-dev branch (closes#21093).
Discussion
----------
[Lock] Create a lock component
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | they will
| Fixed tickets | #20382
| License | MIT
| Doc PR | symfony/symfony-docs#7364
This PR aim to add a new component Lock going further than the FileSystem\LockHandler by allowing remote backend (like Redis, memcache, etc)
Inspired by
## Usage
The simplest way to use lock is to inject an instance of a Lock in your service
```php
class MyService
{
private $lock;
public function __construct(LockInterface $lock)
{
$this->lock = $lock;
}
public function run()
{
$this->lock->acquire(true);
// If I'm here, no exception had been raised. Lock is acquired
try {
// do my job
} finally {
$this->lock->release();
}
}
}
```
Configured with something like
```yaml
services:
app.my_service:
class: AppBundle\MyService
arguments:
- app.lock.my_service
app.lock.my_service:
class: Symfony\Component\Lock\Lock
factory: ['@locker', createLock]
arguments: ['my_service']
```
If you need to lock serveral resource on runtime, wou'll nneed to inject the LockFactory.
```php
class MyService
{
private $lockFactory;
public function __construct(LockFactoryInterface $lockFactory)
{
$this->lockFactory = $lockFactory;
}
public function run()
{
foreach ($this->items as $item) {
$lock = $this->lockFactory->createLock((string) $item);
try {
$lock->acquire();
} catch (LockConflictedException $e) {
continue;
}
// When I'm here, no exception had been, raised. Lock is acquired
try {
// do my job
} finally {
$lock->release();
}
}
}
}
```
Configured with something like
```yaml
services:
app.my_service:
class: AppBundle\MyService
arguments:
- '@locker'
```
This component allow you to refresh an expirable lock.
This is usefull, if you run a long operation split in several small parts.
If you lock with a ttl for the overall operatoin time and your process crash, the lock will block everybody for the defined TTL.
But thank to the refresh method, you're able to lock for a small TTL, and refresh it between each parts.
```php
class MyService
{
private $lock;
public function __construct(LockInterface $lock)
{
$this->lock = $lock;
}
public function run()
{
$this->lock->acquire(true);
try {
do {
$finished = $this->performLongTask();
// Increase the expire date by 300 more seconds
$this->lock->refresh();
} while (!$finished)
// do my job
} finally {
$this->lock->release();
}
}
}
```
## Naming anc implementation choise
```
$lock->acquire()
vs
$lock->lock()
```
Choose to use acquire, because this component is full of `lock` Symfony\Component\Lock\Lock::Lock` raised a E_TOO_MANY_LOCK in my head.
```
$lock->acquire(false);
$lock->acquire(true);
vs
$lock->aquire()
$lock->waitAndAquire()
```
Not a big fan of flag feature and 2. But I choose to use the blocking flag to offer a simple (and common usecase) implementation
```
$lock = $factory->createLock($key);
$lock->acquire();
vs
$lock->aquire($key)
```
I choose to a the pool of locks implementation. It allow the user to create 2 instances and use cross lock even in the same process.
```
interface LockInterface
final class Lock implements LockInterface
vs
final class Lock
```
I choose to use a Interface even if there is only one implementaiton to offer an extension point here
# TODO
## In this PR
* [x] tests
* [x] add logs
* [x] offer several redis connectors
* [x] try other store implementation to validate the architecture/interface
## In other PR
* documentation
* add configuration in framework bundle
* add stop watch in the debug bar
* improve the combined store (takes the drift into account and elapsed time between each store)
* implement other stores (memcache, ...)
* use this component in session manipulation (fixes#4976)
Commits
-------
018e0fc330 [Lock] Create a lock component
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Add project directory default for installing assets
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20337
| License | MIT
| Doc PR |
This allows the `assets:install` console command to have a fallback default of the project root directory.
Current behavior is to install assets only in the `target` of the current working directory.
Commits
-------
7a11f3ecf3 [FrameworkBundle] Add project directory default for installing assets
This PR was squashed before being merged into the 3.3-dev branch (closes#20365).
Discussion
----------
[TwigBridge] Handle form label attributes like others
| Q | A |
| --- | --- |
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes
| Fixed tickets | -
| License | MIT |
| Doc PR | -
The HTML for rendering attributes is duplicated in multiple blocks, making it error prone/hard to maintain.
Next, the label attributes followed a different approach. Imo. all should follow the same base rendering, showing the above is actually an issue.
Commits
-------
e317e0aeab [TwigBridge] Handle form label attributes like others
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Translator] Make the Translator works with any PSR-11 container
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Uses a service-locator for collected translation loaders and replace the single call of `getParameter()` by an optional constructor argument.
Commits
-------
85177a649e [FrameworkBundle] Make Translator works with any PSR-11 container
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PhpUnitBridge] add errors as late as possible
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
PHPUnit may change the test's state after the listener's startTest()
method has been executed thus leading to broken test result output.
Commits
-------
167742e521 add errors as late as possible
This PR was squashed before being merged into the 2.7 branch (closes#22099).
Discussion
----------
HttpCache: New test for revalidating responses with an expired TTL
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
See #22035, in particular [this and the following comments](https://github.com/symfony/symfony/pull/22035#issuecomment-287572234).
Commits
-------
067ab52ba0 HttpCache: New test for revalidating responses with an expired TTL
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] [XML] Ignore Process Instruction
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22005
| License | MIT
| Doc PR | N/A
This Pull request ignores Process instruction data in XML for decoding the data.
Commits
-------
0c741f5704 [Serializer] [XML] Ignore Process Instruction
This PR was merged into the 3.3-dev branch.
Discussion
----------
[*Bundle] Add autowiring aliases for common services
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
As spotted while working on #22060, we're missing many aliases to prevent any autowiring ambiguities.
I also removed the "Symfony\Component\EventDispatcher\EventDispatcher" and "Symfony\Component\DependencyInjection\Container" aliases: we'd better encourage using the corresponding interfaces instead.
On ControllerTrait, we need to type hint against SessionInterface, because otherwise, when session support is disabled, autowiring still auto-registers an "autowired.Session" service, which defeats the purpose of being able to enable/disable it.
Commits
-------
08c2ee32f1 [*Bundle] Add autowiring aliases for common services
* 3.2:
Fixes a typo in the form collector styles
[WebProfilerBundle] Fix content-security-policy compatibility
[WebProfilerBundle] Drop dead code
[HttpKernel] Fixed bug with purging of HTTPS URLs
fix some risky tests
[DI] [YamlFileLoader] change error message of a non existing file
[WebProfilerBundle] Handle Content-Security-Policy-Report-Only header correctly
[Security] Added option to return true in the method isRememberMeRequested
* 2.8:
Fixes a typo in the form collector styles
[HttpKernel] Fixed bug with purging of HTTPS URLs
fix some risky tests
[DI] [YamlFileLoader] change error message of a non existing file
[Security] Added option to return true in the method isRememberMeRequested
* 2.7:
[HttpKernel] Fixed bug with purging of HTTPS URLs
fix some risky tests
[DI] [YamlFileLoader] change error message of a non existing file
[Security] Added option to return true in the method isRememberMeRequested
This PR was merged into the 2.7 branch.
Discussion
----------
fix some risky tests
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
PHPUnit 6 marks tests as risky when they have no assertions (and are not marked as skipped or incomplete). This PR will update our test suite accordingly.
Component that still need to be covered:
- [ ] Config
- [ ] Form
- [ ] HttpFoundation
- [ ] Security
- [ ] Workflow
Commits
-------
abf1787dcc fix some risky tests
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add logging and better failure recovery to AutowirePass
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
So useful to understand what autowiring is doing.
Commits
-------
3e297ba3e4 [DI] Add logging and better failure recovery to AutowirePass
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Document removal of server:* commands
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21373
| License | MIT
| Doc PR | n/a
To ease upgrading.
We could also add something like that in the framework application:
```php
public function findNamespace($namespace)
{
try {
return parent::findNamespace($namespace);
} catch (CommandNotFoundException $e) {
if ('server' === $namespace) {
throw new CommandNotFoundException('The "server:start", "server:stop", "server:status" and "server:run" commands have been moved...');
}
}
}
```
But AFAIK we never did so in the past, tell me if we should.
Commits
-------
c99641a540 Document removal of server:* commands from the framework
This PR was merged into the 3.3-dev branch.
Discussion
----------
Fix some invalid phpdoc in the Dotenv class
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
14525b73b8 Fix some invalid phpdoc in the Dotenv class
This PR was merged into the 3.3-dev branch.
Discussion
----------
Release memory for the parsed data after parsing
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
If the Dotenv instance outlives the parsing of the file (which is the case easily in the usage described in the documentation as it is used in the global scope and so the variable does not go out of scope until the end of the process), there is no reason to keep the parsed data in memory after the end of the parsing.
I have not reset the integer properties, as this would not save any memory anyway (integers are inline inside the ZVAL anyway)
Commits
-------
518f618d33 Release memory for the parsed data after parsing
This PR was merged into the 3.3-dev branch.
Discussion
----------
[SecurityBundle] Remove dead code in fixtures
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
afa5ef603c [SecurityBundle] Remove dead code in fixtures
This PR was squashed before being merged into the 2.7 branch (closes#22012).
Discussion
----------
[DI] [YamlFileLoader] change error message of a non existing file
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22007
| License | MIT
| Doc PR | symfony/symfony-docs
This PR replaces the error message when non existing Yaml file is loaded. It gives more sense for the user.
Commits
-------
1c2ea97585 [DI] [YamlFileLoader] change error message of a non existing file
This PR was merged into the 3.2 branch.
Discussion
----------
[WebProfilerBundle] Handle Content-Security-Policy-Report-Only header correctly
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
This header should have been handled from the beginning.
Content-Security-Policy recommendation specify this header, it needs to be correctly handled
Commits
-------
b0ba698111 [WebProfilerBundle] Handle Content-Security-Policy-Report-Only header correctly
* 3.2:
[Yaml] CS
[DI] Fix PhpDumper generated doc block
#20411 fix Yaml parsing for very long quoted strings
[Workflow] add Phpdoc for better IDE support
fix package name in conflict rule
improve message when workflows are missing
[Doctrine Bridge] fix priority for doctrine event listeners
Use PHP functions as array_map callbacks when possible
[Validator] revert wrong Phpdoc change
Use proper line endings
* 2.8:
[DI] Fix PhpDumper generated doc block
#20411 fix Yaml parsing for very long quoted strings
[Doctrine Bridge] fix priority for doctrine event listeners
Use PHP functions as array_map callbacks when possible
[Validator] revert wrong Phpdoc change
Use proper line endings
* 2.7:
#20411 fix Yaml parsing for very long quoted strings
[Doctrine Bridge] fix priority for doctrine event listeners
Use PHP functions as array_map callbacks when possible
[Validator] revert wrong Phpdoc change
Use proper line endings
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Remove skipping magic for autowired methods
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no (master only)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Wildcard based autowiring made it required to auto-skip methods that were not wireable.
Now that things need to be explicit (ie via the `@required` annotation, or via configuration), this "automagic" behavior is not required anymore.
Since it can lead to wtf moments ("*I* did *put that `@required` annotation, why is it ignored by autowiring?*"), I think we should remove it.
This also fixes another issue where configured method calls had their optional arguments wired, while we want only the constructor's to behave as such.
Commits
-------
a6bfe1c [DI] Remove skipping magic for autowired methods
This will forbid using the FrameworkBundle in 3.3 with previous releases
of the Workflow to avoid issues related to the GuardListener class not
being present. Additionally, it provides a useful exception in case the
guard option is used without the ExpressionLanguage component being
installed.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Introduce "container.service_locator" tag, replaces ServiceLocatorArgument
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no (master only)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
I first started working on adding this new "container.service_locator" tag, so here it is.
It allows defining and dumping service-locator services properly, where it wasn't possible previously (you had to create a DI extension to do so.)
Then I realized that this allowed us to entirely drop `ServiceLocatorArgument` and replace it with the more flexible `ServiceClosureArgument`.
This makes things simpler overall, see diff stat.
Commits
-------
5d230b5871 [DI] Introduce "container.service_locator" tag, replaces ServiceLocatorArgument
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Remove useless state from ServiceLocator
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no (master only)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
One less state to manage for the engine, and allows to deal with non-shared services.
Commits
-------
e0a5eecf2a [DI] Remove useless state from ServiceLocator
This PR was squashed before being merged into the 2.7 branch (closes#21523).
Discussion
----------
#20411 fix Yaml parsing for very long quoted strings
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20411
| License | MIT
| Doc PR | no
This is a second fix for the issue discussed in #20411. My first PR (#21279) didn't fix the bug in all cases, sorry.
If a YAML string has too many spaces in the value, it can trigger a `PREG_BACKTRACK_LIMIT_ERROR` error in the Yaml parser.
There should be no behavioural change other than the bug fix
I have included a test which fails before this fix and passes after this fix.
I have also added checks that detect other PCRE internal errors and throw a more descriptive exception. Before this patch, the YAML engine would often give incorrect results, rather than throwing, on a PCRE `PREG_BACKTRACK_LIMIT_ERROR` error.
Commits
-------
c9a1c09182#20411 fix Yaml parsing for very long quoted strings
This PR was merged into the 2.7 branch.
Discussion
----------
[Doctrine Bridge] fix priority for doctrine event listeners
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21977
| License | MIT
| Doc PR | -
This fixes handling the priorities for doctrine event listeners. As found out by @chapterjason in https://github.com/symfony/symfony/issues/21977 the priority was incorrectly handled as soon as a listener had more than one tag (so listening to multiple events).
With this changes all tagged listeners are globally sorted by priority (using the same stable sort approach as in the later available `PriorityTaggedServiceTrait`) and then added one by one to the event manager.
I also updated the tests a bit as it was not covering all cases.
We also have to extend the docs for it I think as it does not mention the `priority` and `lazy` option at all? http://symfony.com/doc/current/doctrine/event_listeners_subscribers.html
Commits
-------
9d9d4efb88 [Doctrine Bridge] fix priority for doctrine event listeners
This PR was merged into the 3.2 branch.
Discussion
----------
[FrameworkBundle] improve message when workflows are missing
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
46c12c9d1d improve message when workflows are missing
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] add Phpdoc for better IDE support
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Allow IDEs to provide more precise auto-completion support.
Commits
-------
916a97c834 [Workflow] add Phpdoc for better IDE support
* 3.2:
[Cache] cache/integration-tests is now compatible with phpunit namespaces
[FrameworkBundle] Fix translation dep constraint
[Workflow] Added more tests
[Cache] Enhance error reporting for FilesystemAdapter
This PR was merged into the 3.2 branch.
Discussion
----------
[FrameworkBundle] fix package name in conflict rule
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22032
| License | MIT
| Doc PR |
Commits
-------
71e93dddf2 fix package name in conflict rule
This PR was merged into the 3.2 branch.
Discussion
----------
[FrameworkBundle] Fix translation dep constraint
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | n/a
The framework Translator makes use of the Translator component domain exceptions which exist since 3.2 only, leading to a fatal error when one of these exceptions is thrown in the framework using `symfony/translations:<3.2`. Bug introduced in https://github.com/symfony/symfony/pull/20012
Commits
-------
e1caf7d [FrameworkBundle] Fix translation dep constraint
This PR was merged into the 3.2 branch.
Discussion
----------
[Cache] Enhance error reporting for FilesystemAdapter
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes/no
| Fixed tickets | -
| License | MIT
| Doc PR | -
So that we can provide feedback for cases like #21995
Commits
-------
ebb316d [Cache] Enhance error reporting for FilesystemAdapter
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Lazy configuration of annotations' loader and `@required`
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This would remove the need for https://github.com/symfony/symfony-standard/pull/1052 and for the `autoload.php` file altogether.
Tested on symfony-demo with great success so far.
Commits
-------
d332b37b4b [FrameworkBundle] Lazy configuration of annotations' loader and `@required`
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Remove the "id" attribute of "callable"
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | ?
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR |
It seems like this attribute was added by mistake as it's used nowhere.
It should be removed but I don't think it's worth adding a bc layer.
Commits
-------
19547a2639 [DependencyInjection] Remove the "id" attribute of "callable"
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Support anonymous services in Yaml
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/16328
| License | MIT
| Doc PR |
This PR allows creating anonymous services in yaml using the `!service` tag as proposed by @nicolas-grekas:
```yml
services:
_instanceof:
FooInterface:
arguments:
- !service
class: Bar
autowire: true
Foo:
factory: [ !service { class: Quz }, 'constructFoo' ]
```
Anonymous services are forbidden in parameters as in xml.
Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.
Commits
-------
9b7138545e [DependencyInjection] Support anonymous services in Yaml
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
As discussed in #21978 here is the second PR.
Commits
-------
857ce7c7be [FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container
This PR was merged into the 3.3-dev branch.
Discussion
----------
301 status code must drop request method to GET.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| BC breaks? | yes
| Tests pass? | yes
| Fixed tickets | #20924
| License | MIT
[RFC 7231 §6.4.2](https://tools.ietf.org/html/rfc7231#section-6.4.2) states that 301 HTTP Code should forward POST requests to the Location URI.
But, it also states that:
> For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request.
This is the behavior implemented in almost all user agents.
However the `BrowserKit` did forward the method to the subsequent request.
This PR make the `BrowserKit` change the request method from POST to GET when the response status code is 301.
Commits
-------
abda966d75 301 status code must drop request method to GET.
This PR was merged into the 2.7 branch.
Discussion
----------
Use PHP functions as array_map callbacks when possible
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We already do that in 99% of the cases ... but there were 3 occurrences where we didn't do it.
Commits
-------
405bd4cc81 Use PHP functions as array_map callbacks when possible
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
Many people already asked for this feature so ... here we go 🎉
---
Usage:
```yml
transitions:
journalist_approval:
guard: "is_fully_authenticated() and has_role('ROLE_JOURNALIST') or is_granted('POST_EDIT', subject)"
from: wait_for_journalist
to: approved_by_journalist
publish:
guard: "subject.isPublic()"
from: approved_by_journalist
to: published
```
Commits
-------
ab3b12d6dc [FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Monolog] Added a new way to follow logs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
----
If you want to try this PR, you can use [my fork](https://github.com/lyrixx/symfony-standard/tree/server-log):
```bash
git clone https://github.com/lyrixx/symfony-standard -b server-log symfony-se-logs
cd symfony-se-logs
composer install
bin/console server:start
bin/console server:log
```
and from anywhere `curl http://0:8000`
---
Basically, it's a new way to view and filter real time logs, from the CLI.
![screenshot13](https://cloud.githubusercontent.com/assets/408368/21898198/52fa8c3c-d8ec-11e6-98db-6b3a6f8fe50d.png)
Commits
-------
ac92375ddb [FrameworkBundle][Monolog] Added a new way to follow logs
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Use proper line endings in BufferedOutput
| 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 | -
`BufferOutput` should be consistent with `StreamOutput` when writing newlines.
I faced an issue using this class in tests where the expected output was platform dependent (using `PHP_EOL` too).
Commits
-------
33946e69c0 Use proper line endings
This PR was merged into the 2.7 branch.
Discussion
----------
[FrameworkBundle] Fix cleaning of test dirs
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
I spent an hour or two today debugging a non existent issue that was related to a non removed temporary file.
Let's cleanup properly now in the base WebTestCase.
Commits
-------
4842c86 [FrameworkBundle] Fix cleaning of test dirs
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Resolve real class when failing on proxies
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/21969
| License | MIT
| Doc PR | n/a
__Before__
> The controller for URI "/" is not callable. Method "home" on class "SymfonyProxy_f6aad6c251e61ad4ae1fc5a561578cae" should be public and non-abstract.
__After__
> The controller for URI "/" is not callable. Method "home" on class "Actions" should be public and non-abstract.
Commits
-------
e34e29a [HttpKernel] Resolve real class when failing on proxies
When registering the error handler, simple-phpunit might be used, and in
that case, the bootstrap process will not have environment variables
defined inside phpunit.xml.dist . This means `$mode` might differ when
registering the error handler, and when an error is triggered.
This raises a question: should the $mode argument be removed to avoid
similar errors in the future?
* 3.2:
[VarDumper] Add missing isset() checks in some casters
[VarDumper] Add missing isset() checks in some casters
[Form] Choice type int values (BC Fix)
bumped Symfony version to 3.2.7
updated VERSION for 3.2.6
updated CHANGELOG for 3.2.6
Use PHPUnit 5.4 instead of 5.3
[PropertyAccess] Use ArrayAdapter in debug mode
bumped Symfony version to 3.2.6
updated VERSION for 3.2.5
updated CHANGELOG for 3.2.5
cached files rely on umask
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection Remove duplicated code
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Arrays are already supported by `YamlFileLoader::resolveServices()` so there's no need to duplicate code.
Commits
-------
1bac3d722d [DependencyInjection Remove duplicated code
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PropertyInfo] Move CHANGELOG.md to the root
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Moves the CHANGELOG of the PropertyInfo Component from the DependencyInjection subdirectory to the component's root.
Commits
-------
d5d3f4285b [PropertyInfo] Move CHANGELOG.md to the root
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Workflow] Added fluent interface to the DefinitionBuilder
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
It seems more logic to me to have this fluent interface.
Commits
-------
4c8963c6ff [Workflow] Added fluent interface to the DefinitionBuilder
This PR was squashed before being merged into the 3.3-dev branch (closes#21933).
Discussion
----------
[FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
This will increase the visibility of the Listener. We could encourage people to use at least `%kernel.debug%` value.
---
Note for the merge: There are two commits, this is done on purpose (2 different things, but easier to do only one PR)
Commits
-------
633c0393b3 [Workflow] Added the workflow name in log generated by AuditTrailListener
b786bccb3a [FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger
This PR was squashed before being merged into the 3.3-dev branch (closes#21937).
Discussion
----------
[DependencyInjection] Handle void return types in closure-proxy
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
I recently got an error when registering an event listener that specifies a `void` return type. Dumping the container generates a closure proxy that always returns a value, which then conflicts with the return type hint.
E.G the following code is generated (some class names removed for readability)
```
$instance->addListener('kernel.view', /** @closure-proxy ... */ function (...\GetResponseForControllerResultEvent $event): void {
return ${($_ = isset($this->services[listener']) ? $this->services['listener'] : $this->get('listener')) && false ?: '_'}->onKernelView($event);
}, 128);
```
This then causes the error `A void function must not return a value in ...`
So void return types should be handled by removing the `return` inside the closure
Commits
-------
a5c5ad1 [DependencyInjection] Handle void return types in closure-proxy
PHPUnit 5.3 doesn't have the forward compatibility layer for PHPUnit 6 so that `PHPUnit\Framework\TestCase` can be used instead of `PHPUnit_Framework_TestCase`.
This generates an error when upgrading to Symfony 3.2.5 without forcing the `SYMFONY_PHPUNIT_VERSION` const:
```
Class 'PHPUnit\Framework\TestCase' not found in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php on line 25
```
This was introduced by c9684ad31f in 3.2.5
* 3.2:
[Workflow] Delete dead code
Rename StackOverflow to Stack Overflow
[travis] Test with hhvm 3.18
[Workflow] Fixed marking state on leave and enter events
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Fix autoloader in insulated clients
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Related to the deprecation of the class loader component:
the `Client` already uses this code in `HttpKernel`, but `FrameworkBundle` is missing the same update.
Spotted while debugging the hhvm 3.18 issue (the chain is: `ComposerResource` sees different vendors, thus says the kernel cache is not fresh, thus it is rebuild, thus we hit https://github.com/facebook/hhvm/issues/7722).
Commits
-------
414ac5d976 [FrameworkBundle] Fix autoloader in insulated clients
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] Delete dead code
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | "no"
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
Me (and all reviewers ;) ) totally miss this class. It has never been used and there are no reason to use it anyway. It's just a relic from the designing of the Component. Sorry.
I really don't think it deserves a deprecation as the component is quite new, and it is really some dead code.
Commits
-------
28e85cc32a [Workflow] Delete dead code
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] Fixed marking state on leave and enter events
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | related to https://github.com/symfony/symfony-docs/pull/7528
It seems weird to me to dispatch an event while the marking is not yet marked by the new places.
The event is still "marked" by old places when leaving occurs, my guess is that the symmetry should be mirrored.
Do you agree? Should I add a test?
Commits
-------
175858a67e [Workflow] Fixed marking state on leave and enter events
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add a check on the getReflectionClass call
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
This prevents from doing a getter injection if the definition's idcannot be resolved to an existing class.
Commits
-------
a6590b3659 [DI] Add a check on the getReflectionClass call
This PR was merged into the 3.3-dev branch.
Discussion
----------
[travis] Master fixes for HHVM 3.18LTS
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21900
| License | MIT
| Doc PR | -
For some reason, the current HHVM 3.15 consistently crashes in its shutdown sequence on master.
Time to move to 3.18?
https://github.com/symfony/symfony/pull/21914/files?w=1
Commits
-------
114d62c [travis] Master fixes for HHVM 3.18LTS
* 3.2:
[Cache] Fix Redis pipelining/multi-ops
[Yaml] Fix the tests
[github] Add a reminder about CHANGELOG.md files
respect the umask argument in dumpFile()
dumpFile(), preserve existing file permissions
[Form] Fixed overridden choices option in extended choice types
Add validate method to mockec validator in form TypeTestCase
bumped Symfony version to 2.8.19
updated VERSION for 2.8.18
updated CHANGELOG for 2.8.18
bumped Symfony version to 2.7.26
updated VERSION for 2.7.25
update CONTRIBUTORS for 2.7.25
updated CHANGELOG for 2.7.25
[HttpKernel] fixed Kernel name when stored in a directory starting with a number
context listener: hardening user provider handling
[Console] Do not squash input changes made from console.command event
[RFC 7231 §6.4.2](https://tools.ietf.org/html/rfc7231#section-6.4.2) states that 301 HTTP Code should forward POST requests to the Location URI.
But, it also states that:
> For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request.
This is the behavior implemented in almost all user agents.
However the `BrowserKit` did forward the method to the subsequent request.
* 2.8:
respect the umask argument in dumpFile()
dumpFile(), preserve existing file permissions
Add validate method to mockec validator in form TypeTestCase
bumped Symfony version to 2.8.19
updated VERSION for 2.8.18
updated CHANGELOG for 2.8.18
bumped Symfony version to 2.7.26
updated VERSION for 2.7.25
update CONTRIBUTORS for 2.7.25
updated CHANGELOG for 2.7.25
[HttpKernel] fixed Kernel name when stored in a directory starting with a number
context listener: hardening user provider handling
[Console] Do not squash input changes made from console.command event
* 2.7:
respect the umask argument in dumpFile()
dumpFile(), preserve existing file permissions
Add validate method to mockec validator in form TypeTestCase
bumped Symfony version to 2.7.26
updated VERSION for 2.7.25
update CONTRIBUTORS for 2.7.25
updated CHANGELOG for 2.7.25
[HttpKernel] fixed Kernel name when stored in a directory starting with a number
context listener: hardening user provider handling
This PR was squashed before being merged into the 3.3-dev branch (closes#21780).
Discussion
----------
[DX] [Form] Add helper method to register form extensions during unit testing
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | symfony/symfony-docs#7578
Add helper method to register form extensions during unit testing, so it's easier to register custom form type extensions, form types, or type guessers
Commits
-------
bab562a987 [DX] [Form] Add helper method to register form extensions during unit testing
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Allow signing URIs with a custom query string parameter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
`UriSigner` is currently restricting to using `_hash` as the query string parameter, this makes is customisable.
Commits
-------
32301c3a30 Allow a custom query string parameter
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Bridge/Monolog] Enhance the Console Handler
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | -
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
I extracted and enhanced the formatting logic from #21080.
Basically, The formatter now use the VarDumper & use more significant colors and has a more compact / readable format (IMHO).
---
I used the following code to generate before/after screenshots.
```php
protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getContainer()->get('logger');
$filesystem = $this->getContainer()->get('filesystem');
$anObject = new \stdClass;
$anObject->firstPpt = 'foo';
$anObject->secondePpt = 'bar';
$logger->log('notice', 'Hello {who}', [
'who' => 'Wold',
'an_object' => $anObject,
'file_system' => $filesystem,
]);
$r = new \ReflectionClass(LogLevel::class);
foreach ($r->getConstants() as $level) {
$logger = $logger->withName($level);
$logger->log($level, 'log at level {level}', [
'level' => $level,
]);
}
}
```
before:
![screenshot12](https://cloud.githubusercontent.com/assets/408368/23183075/0bb21f80-f87b-11e6-8123-f6da70f2493b.png)
After:
![screenshot11](https://cloud.githubusercontent.com/assets/408368/23182971/b4022ed8-f87a-11e6-9d3b-de1a9d4ce9aa.png)
Commits
-------
b663ab5246 [Bridge/Monolog] Enhanced the Console Handler
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] context listener: hardening user provider handling
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #4498
| License | MIT
| Doc PR |
After the wrong fix in #21791 this is the second attempt to solve #4498. If more than one user provider support the user for the current context, all of them will be applied instead of returning prematurely when the first user provider does not find the logged in user.
Commits
-------
0fb09293fd context listener: hardening user provider handling
This PR was merged into the 2.7 branch.
Discussion
----------
[HttpKernel] fix Kernel name when stored in a directory starting with a number
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20489
| License | MIT
| Doc PR | -
replaces #20750
Commits
-------
f244eb8414 [HttpKernel] fixed Kernel name when stored in a directory starting with a number
This PR was merged into the 2.8 branch.
Discussion
----------
[Console] Do not squash input changes made from console.command event
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/19441
| License | MIT
| Doc PR | n/a
Setting arguments/options from the `console.command` event is expected to work since https://github.com/symfony/symfony/pull/15938
Commits
-------
c8d364b721 [Console] Do not squash input changes made from console.command event
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Allow extensions to create ServiceLocator as services
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
https://github.com/symfony/symfony/pull/21770/files?w=1
With this PR, DI extensions are able to create "service locator" services.
They are easily created as such:
```php
$container->register('my_service_locator', ServiceLocator::class)
->addArgument(array(
'exposed_id' => new ServiceClosureArgument(new Reference('internal_id')),
))
```
I already need this in two different PRs to come.
Commits
-------
1d9663326e [DI] Allow creating ServiceLocator-based services in extensions
This PR was merged into the 2.7 branch.
Discussion
----------
[Form] Fixed typo in a test after #21877
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Reviewing the diff on GitHub, I realized I've missed some typos in a new test of #21877. Sorry!
Commits
-------
b21a0978de [Form] Fixed typo in a test after #21877
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][Router][DX] Invalidate routing cache when container parameters changed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21426
| License | MIT
| Doc PR | N/A
Supersedes #21443 but only for master.
Indeed, this implementation uses a new feature: a `ContainerParametersResource` which compares cached containers parameters (collected at some point, here by the `Router`) with current ones in the container.
On the contrary of the previous PR targeting 2.7, this will only invalidate routing cache when parameters actually used in the routes changed and will avoid always rebuilding the routing cache when the container is rebuilt, just to catch the edge case of someone modifying a parameter.
Commits
-------
fad4d9e2ef [DI][Router][DX] Invalidate routing cache when container parameters changed
* 3.2:
[Serializer] Xml encoder throws exception for valid data
[Form] Hardened form type tests
fixed CS
Added setInputStream deprecation to UPGRADE guides
fixed CS
This PR was merged into the 2.7 branch.
Discussion
----------
[Form] Hardened form type tests
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
This one the PRs to come targeting 2.7 needed to harden the code base before doing some changes in master.
It takes care of the form types tests part (even if some other tests will be added later, it will also be easier after it), and unlocks merging https://github.com/symfony/symfony/pull/21481.
It also back ports tests added in https://github.com/symfony/symfony/pull/18357 for the TextType.
Since it's very hard to merge branches when modifying tests because of BC, and making every test type extend the base type test would involve many function calls to get the tested type, the function `getTestedType` is no longer abstract and return a constant to override instead, it's much better for performance, I didn't change the call in the base type test to keep BC but I suggest to deprecate it in master. Even if those are tests I really think it is worth keeping BC here.
The constants also ease testing in the ecosystem of form related libraries that need to be compatible with Symfony 2.7 and 3. I think using "test" as both prefix and suffix on namespaces, classes and names of the constants should discourage using them in real application code. Since this is just about our test suite, I don't think this should be considered a feature, so tis change should be good for 2.7.
Two other PRs will follow to solve conflicts in 2.8 and 3.2.
I missed last month patches, I hope I won't this time :).
Commits
-------
8cfc3e92ed [Form] Hardened form type tests
This PR was squashed before being merged into the 2.7 branch (closes#21671).
Discussion
----------
[Serializer] Xml encoder throws exception for valid data
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21617
| License | MIT
| Doc PR | None
#21617 Xml encoder throws exception for valid data
- add tests for bool and object encoding
- fix encoding for object in array and field
Commits
-------
5c2d4c671e [Serializer] Xml encoder throws exception for valid data
This PR was merged into the 3.3-dev branch.
Discussion
----------
Add deprecation note on routing class parameters
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/21735
| License | MIT
| Doc PR | no
Create PR with note about deprecation of class parameters.
https://github.com/symfony/symfony/pull/21739#issuecomment-283413593
Commits
-------
5b0641ebe1 Add deprecation note on routing class parameters
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] fix test class location
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Keeping the test file in the old location means that it is not available in the `symfony/security-http` subtree split.
Commits
-------
b4e803a [Security] fix test class location
* 3.2:
[Security] fix Composer constraint
Provide less state in getRequestFormat
fix test class location
Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed
Adding use statement for InvalidArgumentException
* 2.8:
[Security] fix Composer constraint
Provide less state in getRequestFormat
fix test class location
Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed
* 2.7:
[Security] fix Composer constraint
Provide less state in getRequestFormat
fix test class location
Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] fix Composer constraint
| 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 |
The `MAX_USERNAME_LENGTH` constant introduced by #18733 that is used in the `UsernamePasswordFormAuthenticationListener` was first part of Symfony 2.7.13 and 2.8.6.
Commits
-------
69a572d [Security] fix Composer constraint
This PR was merged into the 2.7 branch.
Discussion
----------
[Security] fix test class location
| 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 |
Keeping the test file in the old location means that it is not available in the `symfony/security-http` subtree split.
Commits
-------
1ed0092 fix test class location
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Form] fix BC layer of Form DependencyInjection extension
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
ab487e4 fix BC layer of Form DependencyInjection extension
This PR was squashed before being merged into the 3.3-dev branch (closes#18193).
Discussion
----------
[FrameworkBundle] Introduce autowirable ControllerTrait
| Q | A |
| --- | --- |
| Branch | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #16863 |
| License | MIT |
| Doc PR | todo |
This is the missing part of the new controller system and it's fully BC with the old one.
Used together with the existing autowiring system, #17608 and [DunglasActionBundle](https://github.com/dunglas/DunglasActionBundle) it permits to inject explicit dependencies in controllers with 0 line of config. It's a great DX improvement for Symfony.
It also has a lot of another advantages including enabling to reuse controller accros frameworks and make them easier to test. See https://dunglas.fr/2016/01/dunglasactionbundle-symfony-controllers-redesigned/ for all arguments.
Magic methods of old controllers are still available if you use this new trait in actions.
For instance, the [`BlogController::newAction`](https://github.com/symfony/symfony-demo/blob/master/src/AppBundle/Controller/Admin/BlogController.php#L70) form the `symfony-demo` can now looks like:
``` php
namespace AppBundle\Action\Admin;
use AppBundle\Form\PostType;
use AppBundle\Utils\Slugger;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class NewAction {
use ControllerTrait;
private $slugger;
public function __construct(Slugger $slugger)
{
$this->slugger = $slugger;
}
/**
* @Route("/new", name="admin_post_new")
*/
public function __invoke(Request $request)
{
$post = new Post();
$post->setAuthorEmail($this->getUser()->getEmail());
$form = $this->createForm(PostType::class, $post)->add('saveAndCreateNew', SubmitType::class);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$post->setSlug($this->slugger->slugify($post->getTitle()));
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($post);
$entityManager->flush();
$this->addFlash('success', 'post.created_successfully');
if ($form->get('saveAndCreateNew')->isClicked()) {
return $this->redirectToRoute('admin_post_new');
}
return $this->redirectToRoute('admin_post_index');
}
return $this->render('admin/blog/new.html.twig', array(
'post' => $post,
'form' => $form->createView(),
));
}
}
```
As you can see, there is no need to register the `slugger` service in `services.yml` anymore and the dependency is explicitly injected. In fact the container is not injected in controllers anymore.
Convenience methods still work if the `ControllerTrait` is used (of course it's not mandatory). Here I've made the choice to use an invokable class but this is 100% optional, a class can still contain several actions if wanted.
Annotations like `@Route` still work too. The old `abstract` controller isn't deprecated. There is no valid reason to deprecate it IMO. People liking using the "old" way still can.
Unless in #16863, there is only one trait. This trait/class is basically a bunch of proxy methods to help newcomers. If you want to use only some methods, or want explicit dependencies (better), just inject the service you need in the constructor and don't use the trait.
I'll create open a PR on the standard edition soon to include ActionBundle and provide a dev version of the standard edition to be able to play with this new system.
I'll also backport tests added to the old controller test in 2.3+.
**Edit:** It now uses getter injection to benefit from lazy service loading by default.
Commits
-------
1f2521e347 [FrameworkBundle] Introduce autowirable ControllerTrait
This PR was squashed before being merged into the 3.3-dev branch (closes#20680).
Discussion
----------
DoctrineDataCollector: taught sanitizeParam to support classes with __toString implemented.
This PR teaches \Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector::sanitizeParam support objects, which implement __toString and therefore can be represented as a string with more sense, than "(object) ClassName". It also includes test for the feature.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | [20673](https://github.com/symfony/symfony/issues/20673)
| License | MIT
| Doc PR | no
Commits
-------
f2970f22ac DoctrineDataCollector: taught sanitizeParam to support classes with __toString implemented.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Config] Sort "globbed" paths to make them predictable
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Spotted while reviewing #21832
ping @jakzal FYI
Note that glob already sorts its output, and Finder and glob skip dot dirs.
Commits
-------
ea1defff53 [Config] Sort "globbed" paths to make them predictable
This PR was merged into the 2.7 branch.
Discussion
----------
[Routing] Ignore hidden directories when loading routes from annotations
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21497
| License | MIT
| Doc PR | -
The problem surfaced after implementing #18869. Therefore it doesn't exist on 2.7, but I'd still merge it there to avoid conflicts when merging between branches. Without this fix, the oldest branch the added test will fail is 3.2.
Commits
-------
ce9df0237c [Routing] Ignore hidden directories when loading routes from annotations
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] Fix legacy support for omitting mapping key
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Quick and dirty fix for the failing legacy `InlineTest::testOmittedMappingKeyIsParsedAsColon()` test (failing since https://github.com/symfony/symfony/pull/21118).
Ping @xabbuh : I'm not used to the yaml component codebase and it's probably not the most pleasant one to read. 😄 So if you think there is a cleaner way to go, please just close this one in favor of yours.
Commits
-------
d246f2f [Yaml] Fix legacy support for omitting mapping key
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PhpUnitBridge] include expected deprecations in assertion counter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21786#issuecomment-283074426
| License | MIT
| Doc PR |
We still need to include the changes from #21786 as we cannot increment the number of assertions in the `startTest()` method (the PHPUnit test runner resets the counter after the listeners have been executed).
Commits
-------
cdcd5ae include expected deprecations in assertion counter
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PhpUnitBride] disable global test listener when not registered
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.
Commits
-------
f4cd6708b7 disable global test listener when not registered
This PR was squashed before being merged into the 3.3-dev branch (closes#21763).
Discussion
----------
[DI] Replace wildcard-based methods autowiring by `@required` annotation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no (affects things that are only on master)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
While playing a bit with new features in master around DI configuration, several people around me got bitten by wildcard-based autowiring. The typical example is adding `autowire: [set*]` in `_defaults`: use that on `resource: ../src/Command/` PSR4-based loading and boom, `setApplication` and `setHelperSet` will now be wrongly called. You could tell me "of course, don't to that" - but being bitten so early on a master-only feature makes me really unconfident that this will be easy enough for people after the release.
If wildcard-based autowiring is removed, then I don't see anymore the need for allowing arrays as in `autowire: [setFoo,getBar]`. Moreover, this array syntax has a core DX issue: it's a dead end as far as the learning curve is concerned. You learn it, then when becoming a more advanced dev, someone teaches you that you'd better use another syntax: explicit wiring.
And in fact, we don't need it at all, because something else already exists: just declare a method call, but don't define its arguments. If `autowire: true` is set, then the AutowiringPass already fills in the holes. There is only one tweak required to make this work: don't autowire optional arguments for method calls - or that'd be a BC break. To my PoV that's even better: this makes autowiring fit a "do the minimum to make it work" strategy. A really good one to me.
But there is still an issue: wildcard-based autowiring fits a need. Namely, it allows one to define a convention (eg. `'set*'`), and have all such methods that follow the convention be autowired. To me, this looks like doing it reverse (the DI config should adapt to the code, not reverse). So, to fill this need, let the declaration be in the source: just use an annotation!
This PR adds support for the `@required` annotation, borrowed from the Spring framework:
https://www.tutorialspoint.com/spring/spring_required_annotation.htm
Using the annotation is totally optional of course. If you do, *and if autowiring is on*, then it'll be autowired. If you don't, nothing changes: do manual wiring.
Even when not using autowiring, the annotation is still a nice hint for the consumer of your classes: it tells the reader that this method needs to be called for correct instantiation - thus lowering one drawback of setter injection (discoverability).
The implementation of the annotation parsing is done using a few regexp (no dep on any complex parser) - and works with inheritance, by leveraging the `@inheritdoc` tag (the default behavior being to *not* inherit anything from parent methods).
All in all, looking at the diff stats, it makes everything simpler. Good sign, isn't it?
Commits
-------
f286fcc25f [DI] Replace wildcard-based methods autowiring by `@required` annotation
9081699980 Revert "minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi)"
The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.
The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.
* 3.2:
fixed tests
fixed tests
revert typo fix
[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
Fix phpstorm helper to the official format
Test inline styles with non-decorated formatter
Fix RuntimeException when an Emacs buffer is modified
[Yaml] add tests for specific mapping keys
* 2.8:
fixed tests
revert typo fix
[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
Test inline styles with non-decorated formatter
Fix RuntimeException when an Emacs buffer is modified
[Yaml] add tests for specific mapping keys
* 2.7:
revert typo fix
[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
Test inline styles with non-decorated formatter
Fix RuntimeException when an Emacs buffer is modified
[Yaml] add tests for specific mapping keys
This PR was squashed before being merged into the 3.3-dev branch (closes#21730).
Discussion
----------
[DependencyInjection] Use a service locator in AddConstraintValidatorsPass
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Use a service locator to load constraint validators: it allows them to be private.
Commits
-------
597b6bcab6 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] parse omitted inlined mapping values as null
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/20841#discussion_r91751290
| License | MIT
| Doc PR |
As @GuilhemN mentioned in https://github.com/symfony/symfony/pull/20841#discussion_r91751290 when using the inline YAML notation, it is currently not possible to completely omit the mapping value to have it parsed as `null` (you have to pass `~` or `null` explicitly).
Commits
-------
c473504a95 parse omitted inlined mapping values as null
This PR was merged into the 3.3-dev branch.
Discussion
----------
Revert "[SecurityBundle] only pass relevant user provider"
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21809, #21810
| License | MIT
| Doc PR |
This reverts commit d97e07fd6a (applies #21798 on `master`). There is no merge commit that could be reverted.
Commits
-------
5b016cef7b Revert "[SecurityBundle] only pass relevant user provider"
This PR was squashed before being merged into the 2.7 branch (closes#21267).
Discussion
----------
[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
| 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 | -
Fixed ChoiceType to protect against some problem caused by treating of array.
Let's say we have the choice-form like:
```php
$form = $factory->create(ChoiceType, null, [
'choices' => [
'A',
'B',
'C',
],
'expanded' => true,
'multiple' => true,
]);
```
Then, submit data like this:
```php
$form->submit([
[], // unnecessality nested
]);
```
(Yes, I agree in most cases these situation doesn't happen, but can be)
Then, we get `array_flip(): Can only flip STRING and INTEGER values!` error at [here](6babdb3296/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php (L114)).
Even if form is not `multiple`, annoying `Array to string conversion` error occurs in [here](6babdb3296/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php (L144)) (via [ChoicesToValuesTransformer](5129c4cf7e/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php (L74))).
(As far as I know, non-multiple and non-expanded form has no problem, thanks to [ChoiceToValueTransformer](6babdb3296/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php (L43)))
To resolve these problems, I just added a simple-validation listener to choice type.
Commits
-------
64d7a82d28 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
This PR was merged into the 3.2 branch.
Discussion
----------
Update phpstorm helper to the official format
| Q | A
| ------------- | ---
| Branch? | 3.2 <!--see comment below-->
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Commits
-------
eb09d7cc2e Fix phpstorm helper to the official format
This PR was merged into the 2.7 branch.
Discussion
----------
[Yaml] add tests for specific mapping keys
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | see https://github.com/symfony/symfony/pull/21643#discussion_r101703130
| License | MIT
| Doc PR |
Commits
-------
b8e0d705f6 [Yaml] add tests for specific mapping keys
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PhpUnitBridge] do not register the test listener twice
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
If the listener is already configured through the PHPUnit config, there
is no need to also enable it explicitly in the test runner.
Commits
-------
f7bdfd068f do not register the test listener twice
This PR was merged into the 2.7 branch.
Discussion
----------
Fix emacs link
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes (minor)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | none
When an Emacs buffer is modified, by default Emacs automatically creates a
temporary symlink in the same directory as the file being edited (e.g. Controller.php):
```
.#Controller.php -> user@host.12345:1296583136
```
where '12345' is [the Emacs' PID][1].
In this case Symfony breaks with a RuntimeException:
```
SplFileInfo::getMTime(): stat failed for ...Bundle/Controller/.#APIController.php
```
in
vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php
at line 89
```
$newestMTime = max($file->getMTime(), $newestMTime);
```
[1]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html
Commits
-------
c6f7ca6fa1 Fix RuntimeException when an Emacs buffer is modified
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Deprecate X-Status-Code for better alternative
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | yes |
| Tests pass? | yes |
| Fixed tickets | #12343 |
| License | MIT |
| Doc PR | https://github.com/symfony/symfony-docs/pull/6948 |
This marks the X-Status-Code header method of setting a custom response status
code in exception listeners for a better alternative. There is now a new method
on the `GetResponseForExceptionEvent` that allows successful status codes in
the response sent to the client.
The old method of setting the X-Status-Code header will now throw a deprecation warning.
Instead, in your exception listener you simply call `GetResponseForExceptionEvent::allowCustomResponseCode()` which will tell the Kernel not to override the status code of the event's response object.
Currenty the `X-Status-Code` header will still be removed, so as not to change the existing behaviour, but this is something we can remove in 4.0.
TODO:
- [x] Replace usage of X-Status-Code in `FormAuthenticationEntryPoint`
- [x] Open Silex issue
- [x] Rename method on the response
- [x] Ensure correct response code is set in `AuthenticationEntryPointInterface` implementations
- [x] Ensure the exception listeners are marking `GetResponseForExceptionEvent` as allowing a custom response code
- [x] In the Security component we should only use the new method of setting a custom response code if it is available, and fall back to the `X-Status-Code` method
Commits
-------
cc0ef282cd [HttpKernel] Deprecate X-Status-Code for better alternative
This PR was merged into the 3.3-dev branch.
Discussion
----------
Fix DI test
| Q | A
| ------------- | ---
| Branch? | master
| Tests pass? | yes
Should fix appveyor/travis builds
Commits
-------
8740e44086 Fix DI test
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] make the service container builder register its own self referencing definition
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Commits
-------
9c97496b5f [DependencyInjection] make the service container builder register the definition of its related service container service (and aliases) in order to make compiler passes be able to reference the special service_container service.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Routing][DX] Add full route definition for invokable controller/class
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
| Doc PR | _not yet_
Currently the [`@Route`][1] annotation can be set on the class (for global parameters only). This PR allows you to define the full route annotation for _single_ controllers on the class.
Here a common use case of [ADR pattern][3] applied to Symfony:
**Before:**
```
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
* @Route(service="AppBundle\Controller\Hello")
*/
class Hello
{
private $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @Route("/hello/{name}", name="hello")
*/
public function __invoke($name = 'World')
{
$this->logger->info('log entry...');
return new Response(sprintf('Hello %s!', $name));
}
}
```
**After:**
```
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
* @Route("/hello/{name}", name="hello", service="AppBundle\Controller\Hello")
*/
class Hello
{
private $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public function __invoke($name = 'World')
{
$this->logger->info('log entry...');
return new Response(sprintf('Hello %s!', $name));
}
}
```
This feature does not break any behavior before and works under these conditions:
* The class cannot contain other methods with `@Route` annotation (otherwise, this works as before: used for global parameters).
* <del>The class `@Route` must have the `name` option defined (otherwise, the route is ignored).</del> This one is auto-generated if `null`.
* The class must be invokable: [`__invoke()` method][2] (otherwise, the route is ignored).
Btw, this PR fix the inconsistency with other route definitions (xml, yml) where the `_controller` parameter points to the class name only (i.e. without method).
[1]: https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Routing/Annotation/Route.php
[2]: http://php.net/manual/en/language.oop5.magic.php#object.invoke
[3]: https://github.com/pmjones/adr
Commits
-------
34e360ade3 Add full route definition to invokable class
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Add a ContainerControllerResolver (psr-11)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Extracts the controller as service resolution from the framework bundle controller resolver in a `Symfony/Component/HttpKernel/Controller/Psr11ControllerResolver`, allowing you to use `HttpKernel` with your own psr-11 container.
Commits
-------
7bbae4159b [HttpKernel] Add a ContainerControllerResolver (psr-11)
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Form] allow form types + form type extensions + form type guessers to be private services
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
This pull request is about making internal form services (aka form types, form type extensions and form type guessers) private. They used to be public until Symfony 3.2 for one valid reason: lazyness. However, Symfony 3.3 now comes with built-in mechanism to support effective lazy loading of private services with service locators and proxies.
This PR makes the `DependencyInjectionExtension` class of the `Form` component leverage these new DI component mechanisms. Form types, form type extensions and form type guessers can now be declared private as a best practice. We decided to make these services private as of Symfony 3.3 and of course it would break BC. But this PR introduces a BC layer using a Symfony trick to keep internal form services public. The service container currently has a known issue where private services are not really private if they're referenced by at least two other services in the container. We use this trick to maintain the legacy services public even though the new API relies on private ones. This trick is done thanks to the `deprecated.form.registry` and `deprecated.form.registry.csrf` fake services that will be removed in Symfony 4.0.
Commits
-------
600e75ce88 [Form] use new service locator in DependencyInjectionExtension class, so that form types can be made private at some point.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Config][FrameworkBundle] Lazy load resource checkers
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
`ResourceCheckerConfigCache::isFresh()` stops on the first resource checker supporting a resource (considered authoritative). Thus no need to instantiate other checkers.
Commits
-------
5a24ee2da1 [Config][FrameworkBundle] Lazy load resource checkers
This PR was squashed before being merged into the 3.3-dev branch (closes#21755).
Discussion
----------
[Routing] Optimised dumped router matcher, prevent unneeded function calls.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | does not apply
The application I'm working on is fairly large. Because we had a routing issue (not caused by the framework) I looked through the dumped routing code. I spotted some easy wins. These changes brought down the time for the `match` method to run from ~ 7.5ms to ~2.5ms. It's not a lot, but it's something. I've profiled it several times with blackfire to confirm. The results were very consistent. Mind you, our application has quite a serious amount of routes, a little over 900.
Commits
-------
dd647ffc8a [Routing] Optimised dumped router matcher, prevent unneeded function calls.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config
| Q | A
| ------------- | ---
| Branch? | master<!--see comment below-->
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes/no
| Fixed tickets | - <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | <!--highly recommended for new features-->
This MR is part of the #21284 todo list
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
bce445f452 Move ConfigCachePass from FrameworkBundle to Config
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Simplify AutowirePass and other master-only cleanups
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
A few minor cleanups and fixes, and an overall simplification of AutowirePass.
Commits
-------
34e5cc7698 [DI] Simplify AutowirePass and other master-only cleanups
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PhpUnitBridge] testing for deprecations is not risky
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
044cc8f14e testing for deprecations is not risky
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] Reduce nesting in YamlFileLoader
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We don't need to check if $this->classes is empty, because isset takes care of it in next call anyway
Diffs on GH are hard to read for this type of change, here is old and new code:
```php
public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
if (null === $this->classes) {
$this->classes = $this->getClassesFromYaml();
}
if (!$this->classes) {
return false;
}
if (isset($this->classes[$classMetadata->getName()])) {
$yaml = $this->classes[$classMetadata->getName()];
if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
...
}
return true;
}
return false;
}
```
```php
public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
if (null === $this->classes) {
$this->classes = $this->getClassesFromYaml();
}
if (!isset($this->classes[$classMetadata->getName()])) {
return false;
}
$yaml = $this->classes[$classMetadata->getName()];
if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
...
}
return true;
}
```
Commits
-------
45f0b16 [Serializer] Reduce nesting in YamlFileLoader
This PR was merged into the 3.3-dev branch.
Discussion
----------
Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)"
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21791
| License | MIT
| Doc PR |
#21792 was a mistake as pointed out by @slaci (see https://github.com/symfony/symfony/pull/21791#issuecomment-282990746) and @stof (see https://github.com/symfony/symfony/pull/21792#issuecomment-282980046).
Commits
-------
3cfa0c7 Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)"
When an Emacs buffer is modified, by default Emacs automatically creates a
temporary symlink in the same directory as the file being edited (e.g. Controller.php):
```
.#Controller.php -> user@host.12345:1296583136
```
where '12345' is Emacs' PID.
In this case Symfony breaks with a RuntimeException:
```
SplFileInfo::getMTime(): stat failed for ...Bundle/Controller/.#APIController.php
```
in
vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php
at line 89
```
$newestMTime = max($file->getMTime(), $newestMTime);
```
This PR was squashed before being merged into the 3.3-dev branch (closes#21792).
Discussion
----------
[Security] deprecate multiple providers in context listener
Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Passing multiple user providers to the context listener does not make
much sense. The listener is only responsible to refresh users for a
particular firewall. Thus, it must only be aware of the user provider
for this particular firewall.
Commits
-------
53df0de7fc [Security] deprecate multiple providers in context listener
fbd9f88e31 [SecurityBundle] only pass relevant user provider
* 3.2:
[SecurityBundle] only pass relevant user provider
[Intl] Make tests pass after the ICU data update
[Intl] Update ICU data to 58.2
do not register the test listener twice
[DependencyInjection] removed dead code.
[Yaml] Stop replacing NULLs when merging
[WebServerBundle] fixed html attribute escape
* 2.8:
[SecurityBundle] only pass relevant user provider
[Intl] Make tests pass after the ICU data update
[Intl] Update ICU data to 58.2
do not register the test listener twice
[DependencyInjection] removed dead code.
[Yaml] Stop replacing NULLs when merging
[WebServerBundle] fixed html attribute escape
* 2.7:
[SecurityBundle] only pass relevant user provider
[Intl] Make tests pass after the ICU data update
[Intl] Update ICU data to 58.2
[DependencyInjection] removed dead code.
[Yaml] Stop replacing NULLs when merging
This PR was merged into the 2.7 branch.
Discussion
----------
[SecurityBundle] only pass relevant user provider
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #4498, #12465, #20401, #21737
| License | MIT
| Doc PR |
There is no need for the context listener to be aware of all the configured user providers. It must only use the provider for the current firewall (the one identified by the context key passed to the constructor) to refresh the user from the session.
Commits
-------
d97e07fd6a [SecurityBundle] only pass relevant user provider
This PR was merged into the 3.3-dev branch.
Discussion
----------
Remove some container injections in favor of service locators
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21553#issuecomment-279214666
| License | MIT
| Doc PR | n/a
Commits
-------
8293b753cf Replace some container injections by service locators
0be9ea8ba1 [EventDispatcher] Fix abstract event subscribers registration
This PR was merged into the 3.3-dev branch.
Discussion
----------
Introduce weak vendors mode
Deprecations coming from the vendors are segregated from other
deprecations. A new mode is introduced, in which deprecations coming
from the vendors are not taken into account when deciding to exit with
an error code.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/7453
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Sample output :
# Weak vendor mode
## With both vendors and non-vendor errors
```
WARNINGS!
Tests: 1068, Assertions: 2714, Warnings: 6, Skipped: 15.
Remaining deprecation notices (1)
some error: 1x
1x in SonataAdminBundleTest::testBuild from Sonata\AdminBundle\Tests
Remaining vendor deprecation notices (4)
Legacy deprecation notices (48)
```
Exit code is 1
## After fixing non-vendor errors
```
WARNINGS!
Tests: 1068, Assertions: 2714, Warnings: 6, Skipped: 15.
Remaining vendor deprecation notices (4)
Legacy deprecation notices (48)
```
Exit code is 0
# TODO
- [x] fix colorization issues (vendor deprecation notices are always in red)
- [x] make the vendor detection more robust
- [x] make the vendor dir configurable
- [x] ~figure out how to run tests and~ add more of them
- [x] test on non-vendor file
- [x] test on vendor file
- [x] do not change the output of other modes
Commits
-------
61fd043dd5 Introduce weak vendors mode
This PR was merged into the 3.3-dev branch.
Discussion
----------
[VarDumper] Allow seamless use of Data clones
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
By implementing `ArrayAccess`, `Countable`, `IteratorAggregate`, `__get`, `__isset` and `__toString`, VarDumper's `Data` objects become seamless and behave almost identically from their original clones values, especially from the PoV of Twig.
In data collectors, this allows replacing the many nested calls to `cloneVar` by a single one.
This makes the code simpler, and should make a significant difference in term of performance.
Todo:
- [x] push a Blackfire profile comparison
- [x] double check that the profiler works as expected.
Commits
-------
ab716c64de [VarDumper] Allow seamless use of Data clones
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Always consider abstract getters as autowiring candidates
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes (a missing part of getter autowiring really)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
When a definition is set to be autowired with no method explicitly configured, we already wire the constructor.
We should also autowire abstract getters - with the same reasoning that makes us autowire the constructor: without concrete getters, the class is unusable. This just makes it usable again.
Commits
-------
8f246bde1d [DI] Always consider abstract getters as autowiring candidates
Passing multiple user providers to the context listener does not make
much sense. The listener is only responsible to refresh users for a
particular firewall. Thus, it must only be aware of the user provider
for this particular firewall.
This PR was squashed before being merged into the 2.7 branch (closes#21790).
Discussion
----------
[Intl] Update ICU data to 58.2
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
ICU 58.2 was released: http://site.icu-project.org/download/58
Commits
-------
d135e5cd2f [Intl] Make tests pass after the ICU data update
65faa1043d [Intl] Update ICU data to 58.2
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fix ordering of tags inheritance
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Tag inheritance should have predictable ordering, from child to parents.
This PR also adds tests for ResolveDefinitionInheritancePass (heavily inspired by ResolveDefinitionTemplatePass).
Commits
-------
18e7681fc5 [DI] Fix ordering of tags inheritance
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Form][Serializer] Add missing conflicts for DI
| Q | A
| ------------- | ---
| Branch? | master
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21375#discussion_r103180920
| License | MIT
They make use of `PriorityTaggedServiceTrait` which is available since 3.2 only
Commits
-------
ddae4eff50 [Form][Serializer] Add missing conflicts for DI
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Remove experimental status from service-locator argument type
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21625#issuecomment-282483374, https://github.com/symfony/symfony/pull/21625#discussion_r102232221, #21710
| License | MIT
The `service-locator` argument type is not controversial to me. We know its scope, nothing really surprising, just a map of services to be lazily loaded like `iterator` is (which is not experimental) but keyed.
About its api, it's just PSR-11 restricted to objects, nothing that can't be changed safely in the future.
As stated in https://github.com/symfony/symfony/pull/21625#issuecomment-282483374, it proven its usefulness already. I think what we were looking for by flagging it experimental is just to see it in action, we've 3 opened PRs for that (#21625, #21690, #21730).
This allows introducing deprecations for making use of the feature in the core, thus unlocks #21625 and #21690.
Commits
-------
46dc47af11 [DI] Remove experimental status from service-locator argument type
This PR was merged into the 3.3-dev branch.
Discussion
----------
[HttpKernel] Added the SessionValueResolver
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21159
| License | MIT
| Doc PR | (soon)
This feature adds the `SessionValueResolver`. That means that you no longer have to rely on injecting a `SessionInterface` implementation via the constructor or getting this implementation from the `Request`. Regardless of method, it does not know about the `getFlashBag()`.
By adding the `Session` to the action arguments, you can now type-hint against the implementation rather than interface, which contains the `getFlashBag()`, making it accessible rather than using duck-typing.
_It should also feel less like injecting a service into the constructor which has a state or getting a service from the request._
**Old Situation**
```php
class Controller
{
public function __construct(SessionInterface $session) { /* ... */ }
public function fooAction(Request $request)
{
$this->get('session')->get(...);
$request->getSession()->get(...);
$this->session->get(...)
// duck-typing
$this->get('session')->getFlashBag();
$request->getSession()->getFlashBag();
$this->session->getFlashBag();
$this->addFlash(...);
}
}
```
**New Situation** _- The controller shortcut for flashbag could in theory be removed now_
```php
class Controller
{
public function fooAction(Session $session)
{
$session->get(...);
$session->getFlashBag();
}
}
```
Commits
-------
b4464dcea1 Added the SessionValueResolver
This PR was merged into the 2.8 branch.
Discussion
----------
[WebServerBundle] fixed html attribute escape
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
In the Web Debug Toolbar, when a toolbar item has extra attributes, they are not properly escaped.
(If you put your mouse over the right toolbar item with sf version, you will see a tooltip with `""`)
Currently:
```html
title=""
```
After:
```html
title=""
```
Commits
-------
1337cdb [WebServerBundle] fixed html attribute escape
* 3.2:
Revamped the README file
Fix missing namespace in AddConstraintValidatorPassTest
[SecurityBundle] simplified code
[ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
* 2.8:
Revamped the README file
Fix missing namespace in AddConstraintValidatorPassTest
[ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
* 2.7:
Revamped the README file
Fix missing namespace in AddConstraintValidatorPassTest
[ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
This marks the X-Status-Code header method of setting a custom response
status code in exception listeners as deprecated. Instead there is now
a new method on the GetResponseForExceptionEvent that allows successful
status codes in the response sent to the client.
This PR was merged into the 3.3-dev branch.
Discussion
----------
[SecurityBundle] Don't normalize username of in-memory users
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
It's common to have e.g. emails as keys in `security.providers.in_memory.users` since keys are username. Actually they are normalized so `foo-bar@gmail.com` becomes `foo_bar@gmail.com` and authentication fails unexpectedly.
Commits
-------
8d03332726 [SecurityBundle] Don't normalize keys of in-memory users
This PR was merged into the 2.7 branch.
Discussion
----------
[SecurityBundle] fix priority ordering of security voters
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21660
| License | MIT
| Doc PR |
Could be updated in the `3.2` branch to make use of the `PriorityTaggedServiceTrait `.
Commits
-------
dcd19f3cf9 fix priority ordering of security voters
A new mode is introduced, in which deprecations coming from the vendors
are not taken into account when deciding to exit with an error code. In
this mode, deprecations coming from the vendors are segregated from
other deprecations.
This PR was merged into the 3.2 branch.
Discussion
----------
[DoctrineBridge] Fixed validating custom doctrine type columns
| Q | A
| ------------- | ---
| Branch? | 3.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21619
| License | MIT
| Doc PR | -
This fixes#21619 by not assuming the invalid `$value` is a Doctrine entity if its an object
Commits
-------
ad59370241 [DoctrineBridge] Fixed validating custom doctrine type columns
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Bridge/PhpUnit] Add PHPUnit 6 support
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21125
| License | MIT
| Doc PR | -
This PR makes our phpunit bridge compatible with all namespaced versions of phpunit, from 4.8.35 to 6.
It takes another approach than #21668 and #21221, thus replaces them.
Tested locally : tests pass when using phpunit 5.7, and fails with v6.0 because our own test suite is not yet compatible with it - but at least it runs nice.
If this were handled as usual Symfony component, we would consider some changes to be BC breaks. But in this specific case - a phpunit bridge - it makes no sense to me to apply the bc policy here. I added `@final` and `@internal` annotations to make this clearer.
Commits
-------
9e0745c [Bridge/PhpUnit] Add PHPUnit 6 support
* 3.2:
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Further refactorings to PHPUnit namespaces
resolve parameters in definition classes
* 2.8:
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
Further refactorings to PHPUnit namespaces
resolve parameters in definition classes
This PR was merged into the 2.8 branch.
Discussion
----------
Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
Continued work to make Symfony PHPUnit 6 compatible.
Commits
-------
dbe8898 Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
This PR was squashed before being merged into the 2.7 branch (closes#21688).
Discussion
----------
Further refactorings to PHPUnit namespaces
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
Continued work to make Symfony PHPUnit 6 compatible
Commits
-------
de8106f Further refactorings to PHPUnit namespaces
This PR was squashed before being merged into the 3.3-dev branch (closes#21122).
Discussion
----------
[ExpressionLanguage] Create an ExpressionFunction from a PHP function name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
When we [extend Expression Language](http://symfony.com/doc/current/components/expression_language/extending.html), we often need to add PHP functions whose code is repetitive and redundant at the compiler/evaluator level. This PR proposes a new way more generic which allows to add a PHP function.
currently:
```php
$el = new ExpressionLanguage();
$compiler = function ($str) {
return sprintf('strtoupper(%s)', $str);
};
$evaluator = function ($arguments, $str) {
return strtoupper($str);
};
$el->addFunction(new ExpressionFunction('strtoupper', $compiler, $evaluator));
$el->evaluate('strtoupper("hello")'); // return "HELLO"
```
with this PR:
```php
$el->addFunction(ExpressionFunction::fromPhp('strtoupper'));
$el->evaluate('strtoupper("hello")'); // return "HELLO"
```
It includes PHP namespaced function:
```php
$el->addFunction(ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'));
$el->evaluate('my_strtoupper("hello")'); // return "HELLO"
```
Commits
-------
44d67ed5f5 [ExpressionLanguage] Create an ExpressionFunction from a PHP function name
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Serializer] Reduce complexity of NameConverter
Cleaner and faster implementation of camelcase normalization.
Speed improvement is particularly visible in long string input.
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
50ca944278 [Serializer] Reduce complexity of NameConverter
This PR was merged into the 3.3-dev branch.
Discussion
----------
[VarDumper] Added a way to print or not comma separator and/or trailing comma
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
---
Usecase: Be able to display a dump on one line.
It's already used in the following projets: https://github.com/bobthecow/psysh/blob/master/src/Psy/VarDumper/Dumper.php#L93-L95
Commits
-------
1ef07515c1 [VarDumper] Added a way to print or not comma separator and/or trailing comma
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] fix DUMP_EMPTY_ARRAY_AS_SEQUENCE flag value
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
3953d76954 fix DUMP_EMPTY_ARRAY_AS_SEQUENCE flag value
This PR was squashed before being merged into the 2.8 branch (closes#21663).
Discussion
----------
Updated PHPUnit namespaces
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Follow Up of #21564
Commits
-------
205ced4 Updated PHPUnit namespaces
This PR was squashed before being merged into the 3.3-dev branch (closes#21471).
Discussion
----------
[Yaml] Allow dumping empty array as YAML sequence
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9870, #15937, #16266
| License | MIT
| Doc PR |
PHP arrays are dumped as either YAML sequences or mappings, depending on whether the array has continuos integer keys or not.
An empty array is always dumped as a YAML mapping. Sometimes you want it dumped as a YAML sequence instead.
Commits
-------
87ffaf2b77 Bump version number
af7067c3cf Dump empty object as mapping
a6d94c1b53 [Yaml] Allow dumping empty array as YAML sequence
This PR was squashed before being merged into the 3.3-dev branch (closes#21478).
Discussion
----------
[Asset] Add support for preloading with links and HTTP/2 push
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | todo
Allows compatible clients to preload mandatory assets like scripts, stylesheets or images according to [the "preload" working draft of the W3C](https://www.w3.org/TR/preload/).
Thanks to this PR, Symfony will automatically adds `Link` HTTP headers with a `preload` relation for mandatory assets. If an intermediate proxy supports HTTP/2 push, it will convert preload headers. For instance [Cloudflare supports this feature](https://blog.cloudflare.com/using-http-2-server-push-with-php/).
It dramatically increases pages speed and make the web greener because only one TCP connection is used to fetch all mandatory assets (decrease servers and devices loads, improve battery lives).
Usage:
Updated version:
```html
<html>
<body>
Hello
<script src="{{ preload(asset('/scripts/foo.js'), 'script') }}"></script>
</body>
</html>
```
~~First proposal:~~
```html
<html>
<body>
Hello
<script src="{{ preloaded_asset('/scripts/foo.js', 'script') }}"></script>
</body>
</html>
```
- [x] Add tests
Commits
-------
7bab21700d [Asset] Add support for preloading with links and HTTP/2 push
This PR was merged into the 2.7 branch.
Discussion
----------
[Validator] do not guess getter method names
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #5219, #18700
| License | MIT
| Doc PR | TODO
Commits
-------
bd3a90a0c3 [Validator] do not guess getter method names
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Make use of stderr for non reliable output
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Built-in commands should make use of the proper outputs.
As a feature on master, considering that people may actually rely on stdout and the fact commands have been changed a lot since 2.7, I think it's not worth doing this change on lower branches.
Please see also #20586 which adds a `SymfonyStyle::getErrorStyle()` shortcut for easily switching to stderr.
Commits
-------
7b262d8c29 [FrameworkBundle] Use getErrorStyle() when relevant
9a3a5686c8 Use stderr for some other commands
1ee48bfd60 [FrameworkBundle] Make use of stderr for non reliable output
* 3.2:
[DependencyInjection] Fix using autowiring types when there are more than 2 services
[DependencyInjection] Fix autowiring collisions detection
[DI] Bug in autowiring collisions detection
* 2.8:
[DependencyInjection] Fix using autowiring types when there are more than 2 services
[DependencyInjection] Fix autowiring collisions detection
[DI] Bug in autowiring collisions detection
This PR was merged into the 2.8 branch.
Discussion
----------
[DependencyInjection] Fix autowiring types when there are more than 2 services colliding
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
There is a bug in the `AutowirePass`, when using more than 2 services colliding and you want to use the autowiring types: it may not work depending on their order because `notGuessableTypes` is not reset.
Commits
-------
5981278537 [DependencyInjection] Fix using autowiring types when there are more than 2 services
This PR was merged into the 2.8 branch.
Discussion
----------
[DependencyInjection] Fix autowiring collisions detection
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR |
Fixes https://github.com/symfony/symfony/pull/21658 by implementing the second proposal of https://github.com/symfony/symfony/pull/21658#issuecomment-280858452:
> Another idea: store the types used previously and check that new services registered don't implement them.
Commits
-------
bb70472dce [DependencyInjection] Fix autowiring collisions detection
6f578ee514 [DI] Bug in autowiring collisions detection
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] simplify the implementation of SymfonyStyle::comment()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes-ish
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
2321491d3f [Console] simplify the implementation of SymfonyStyle::comment()
* 3.2:
Fix typo in process error message
Update to PHPUnit namespaces
Minor typo fix messsagesData -> messagesData
remove translation data collector when not usable
This PR was squashed before being merged into the 2.7 branch (closes#21564).
Discussion
----------
Update to PHPUnit namespaces
| Q | A
| ------------- | ---
| Branch? | 2.7+
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21534
| License | MIT
| Doc PR | -
Replaces #21540
@nicolas-grekas Is the update of the cache-id like this sufficient? Do we maybe have to specifiy 4.8.35 in simple-phpunit?
Commits
-------
ddd2dff9b2 Update to PHPUnit namespaces
This PR was merged into the 3.3-dev branch.
Discussion
----------
[PropertyInfo] Use iterators for PropertyInfoExtractor
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Most of the time, when using the cache, the property info extractors are not used: the new iterator feature looks perfect to prevent their instantiation.
Commits
-------
38523a9 [PropertyInfo] Use iterators for PropertyInfoExtractor
This PR was squashed before being merged into the 3.3-dev branch (closes#21655).
Discussion
----------
[PropertyInfo] Make classes final
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The classes of the PropertyInfo component do not provide extension points, so imo it's better to make them final in 4.0.
Commits
-------
313fec9 [PropertyInfo] Make classes final
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Add "instanceof" section for local interface-defined configs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This is a direction follow up of #21357 on which we're working together with @dunglas. From the description posted there:
There is some work being done to include features of [DunglasActionBundle](https://github.com/dunglas/DunglasActionBundle) in the core of Symfony. The goal of all those PRs is to improve the developper experience of the framework, allow to develop faster while preserving all benefits of using Symfony (strictness, modularity, extensibility...) and make it easier to learn for newcomers.
This PR implements the tagging feature of ActionBundle in a more generic way. It will help to get rid of `AppBundle` in the the standard edition and to register automatically some classes including commands.
Here is an example of config (that can be embedded in the standard edition) to enable those features:
```yaml
# config/services.yml
services:
_defaults:
autowire: ['get*', 'set*'] # Enable constructor, getter and setter autowiring for all services defined in this file
_instanceof:
Symfony\Component\Console\Command: # Add the console.command tag to all services defined in this file having this type
tags: ['console.command']
# Set tags but also other settings like "public", "autowire" or "shared" here
Twig_ExtensionInterface:
tags: ['twig.extension']
Symfony\Component\EventDispatcher\EventSubscriberInterface:
tags: ['kernel.event_subscriber']
App\: # Register all classes in the src/Controller directory as services
psr4: ../src/{Controller,Command,Twig,EventSubscriber}
```
It's part of our 0 config initiative: controllers and commands will be automatically registered as services and "autowired", allowing the user to create and inject new services without having to write a single line of YAML or XML.
When refactoring changes are also automatically updated and don't require to update config files. It's a big win for rapid application development and prototyping.
Of course, this is fully compatible with the actual way of defining services and it's possible to switch (or mix) approaches very easily. It's even possible to start prototyping using 0config features then switch to explicit services definitions when the project becomes mature.
Commits
-------
773eca7794 [DependencyInjection] Tests + refacto for "instanceof" definitions
2fb601983f [DependencyInjection] Add "instanceof" section for local interface-defined configs
This PR was merged into the 2.7 branch.
Discussion
----------
[FrameworkBundle] remove translation data collector when not usable
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #17957
| License | MIT
| Doc PR |
Commits
-------
303bb73971 remove translation data collector when not usable
* 3.2:
consistently parse omitted keys as the colon
bumped Symfony version to 3.2.5
updated VERSION for 3.2.4
update CONTRIBUTORS for 3.2.4
updated CHANGELOG for 3.2.4
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Don't try to instantiate reflection class if it doesn't exist
| Q | A
| ------------- | ---
| Branch? | master
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Introduced in https://github.com/symfony/symfony/pull/21419 so master only.
It breaks on bundles that ~~do not use the convention for naming their `Configuration`~~ do not have configuration, e.g. SecurityBundle's FirewallEntryPointExtension for which tests are actually broken (see travis).
Commits
-------
f9b917a60a [DI] Don't instantiate unexisting reflection class
This PR was squashed before being merged into the 3.3-dev branch (closes#20896).
Discussion
----------
[Console] Enhance MarkdownDescriptor
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
In order to add usefulness to this descriptor, this PR allows to jump to a command description by clicking on the command name on the application summary.
It's not a generic approach but IMHO a quick win that should work at least for Github flavoured markdown.
The markdown format should also avoid using `Application::getLongVersion` as the markdown document title, as it may contain tags (and unnecessary information using the framework).
Lastly, the markdown format is now cleaned from tags initially used for console output formatting and only keeps properly escaped ones.
Commits
-------
ef5b087b4f Do not output formatting tags
6896865bcc [Console] MarkdownDescriptor: Don't use getLongVersion
fc2395e237 [Console] MarkdownDescriptor: Link to commands anchors
* 3.2:
Permit empty suffix on Windows
fixed CS
[FrameworkBundle] Remove unused import
[Console][Table] fixed render when using multiple rowspans.
add docblocks for Twig url and path function to improve ide completion
check for circular refs caused by method calls
[Serializer] fix upper camel case conversion (see #21399)
[DI] Auto register extension configuration classes as a resource
[Console] Updated phpdoc on return types
* 2.8:
Permit empty suffix on Windows
[Console][Table] fixed render when using multiple rowspans.
add docblocks for Twig url and path function to improve ide completion
check for circular refs caused by method calls
[Serializer] fix upper camel case conversion (see #21399)
[DI] Auto register extension configuration classes as a resource
[Console] Updated phpdoc on return types
* 2.7:
Permit empty suffix on Windows
[Console][Table] fixed render when using multiple rowspans.
add docblocks for Twig url and path function to improve ide completion
check for circular refs caused by method calls
[Serializer] fix upper camel case conversion (see #21399)
[DI] Auto register extension configuration classes as a resource
[Console] Updated phpdoc on return types
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Form][FrameworkBundle] Move FormPass to the Form component
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
So that anyone using only Form and DI can use it for registering form types/type guessers.
Follows #19443, related to #21284
Commits
-------
e68a6d963c [FrameworkBundle][Form] Move FormPass to the Form component
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle][Serializer] Move SerializerPass to the Serializer
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Part of #21284
Commits
-------
95cf5084c0 [FrameworkBundle][Serializer] Move SerializerPass to the Serializer
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][FrameworkBundle] Show autowired methods in descriptors
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
so we can see the autowired methods using `debug:container`.
Commits
-------
482435c501 [DI][FrameworkBundle] Show autowired methods in descriptors
This PR was merged into the 2.7 branch.
Discussion
----------
[DependencyInjection] check for circular refs caused by method calls
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #19362
| License | MIT
| Doc PR |
Before we check for circular references, dependencies coming from method calls are not part of the dependency graph. That why the pass is not able to detect circular references like the one described in #19362 during compilation of the container.
If we add another check after all the optimisation passes have been processed, we should be able to detect these circular references too.
Commits
-------
fe4f7eccf7 check for circular refs caused by method calls
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] fix upper camel case conversion (see #21399)
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | ?
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21399
| License | MIT
Improve upper camel case support of CamelCaseToSnakeCaseConverter (`ThisIsATest` now converts to `this_is_a_test` instead of `_this_is_a_test`).
Commits
-------
81e771ca1a [Serializer] fix upper camel case conversion (see #21399)
This PR was squashed before being merged into the 3.3-dev branch (closes#21450).
Discussion
----------
[Security] Lazy load guard authenticators and authentication providers
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Authentication stops on the first authenticator that fails or succeeds, let's instantiate them only if actually needed.
Commits
-------
cd6422ae73 [SecurityBundle] Lazy load authentication providers
b8a23ded63 [Security][Guard] Lazy load authenticators
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Deprecate underscore-services in YamlFileLoader
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
As discussed when introducing `_defaults`
Commits
-------
7781082587 [DI] Deprecate underscore-services in YamlFileLoader
This PR was merged into the 2.7 branch.
Discussion
----------
[TwigBridge] Add docblocks for Twig url and path function to improve ide completion
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
`RoutingExtension` missed docblock for Twig extension so `path` and `url` are not fully recognized by PhpStorm.
https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/864 will add more smarter completion
`{{ p<caret> }} -> {{ path('<caret>') }}`, but string parameter is not detected. This will add the minimal docs
Commits
-------
93ab0179f0 add docblocks for Twig url and path function to improve ide completion
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
This simply ensures the new feature is properly considered by the different dumpers, and updates the console descriptors to support the new `ServiceLocatorArgument`.
I also added the number of elements in an array/iterator/service_locator argument when using the `TextDescriptor` in this PR.
(fabbot is complaining about the new yaml tags support)
Commits
-------
aa9074d25a [DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Use glob pattern to load config files
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21173
| License | MIT
| Doc PR | -
This relates to #21173, but I'm not sure if it completely fixes the issue.
This allows to use a glob pattern to load config files, which makes the following possible:
```
# config.yml
imports:
- { resource: "*.yml" }
- { resource: "folder/*.yml" }
- { resource: "/etc/myapp/*.{yml,xml}" }
```
It can also be used in a container extension, if a bundle uses a lot of configs:
```
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('*.yml');
$loader->load('routing/*');
```
Commits
-------
519180ef56 Use glob pattern to load config file
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebProfilerBundle] Make the IP address in the profiler header clickable
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| License | MIT |
Commits
-------
52606a19cf [WebProfilerBundle] Make the IP address in the profiler header clickable to view requests by IP
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Updated phpdoc on return types
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
The return type of “ask” is not necessarily a string (notice that “doAsk” may return mixed type).
Same for “validateAttempts” (validator may return something else than a string).
Commits
-------
442a304292 [Console] Updated phpdoc on return types
This PR was merged into the 2.7 branch.
Discussion
----------
[DI] Auto register extension configuration classes as a resource
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| 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-->
Auto-register an extension configuration class as a resource from a compiler pass; not implicitly by the base extension class.
Causing some extensions to register its configuration, whereas others dont (e.g. framework bundle).
Fixes consistent cache invalidation whenever a configuration definition changes.
Commits
-------
142416b7d4 [DI] Auto register extension configuration classes as a resource
* 3.2: (27 commits)
Improve tracking of environment variables in the case of private services
[DI] Align AutowirePass with 2.8
property constraints can be added in child classes
added test for staticClassLoader in LazyLoadingMetadatafactory
fixed PHPUnit setUp and tearDown method visibility
spelling fixes
Readd Symfony version status in the toolbar
[Security] LdapUserProvider should not throw an exception if the UID key does not exist in an LDAP entry
make sure that null can be the invalid value
[VarDumper] Improve dump of AMQP* Object
Fix annotations cache folder path
[FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap
Ignore missing 'debug.file_link_formatter' service in Debug bundle
[VarDumper] Fixed dumping of terminated generator
bumped Symfony version to 3.2.4
updated VERSION for 3.2.3
updated CHANGELOG for 3.2.3
bumped Symfony version to 2.8.18
updated VERSION for 2.8.17
updated CHANGELOG for 2.8.17
...
* 2.8:
property constraints can be added in child classes
added test for staticClassLoader in LazyLoadingMetadatafactory
spelling fixes
Readd Symfony version status in the toolbar
make sure that null can be the invalid value
[VarDumper] Improve dump of AMQP* Object
[VarDumper] Fixed dumping of terminated generator
bumped Symfony version to 2.8.18
updated VERSION for 2.8.17
updated CHANGELOG for 2.8.17
bumped Symfony version to 2.7.25
updated VERSION for 2.7.24
update CONTRIBUTORS for 2.7.24
updated CHANGELOG for 2.7.24
[FrameworkBundle] Simplify createPackageDefinition
fix directory resource considers same timestamp not fresh
return false early from directory resource
* 2.7:
property constraints can be added in child classes
added test for staticClassLoader in LazyLoadingMetadatafactory
spelling fixes
make sure that null can be the invalid value
bumped Symfony version to 2.7.25
updated VERSION for 2.7.24
update CONTRIBUTORS for 2.7.24
updated CHANGELOG for 2.7.24
[FrameworkBundle] Simplify createPackageDefinition
fix directory resource considers same timestamp not fresh
return false early from directory resource
This PR was merged into the 3.2 branch.
Discussion
----------
[DI] Align AutowirePass with 2.8
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Follow up a less than ideal [merge conflict resolution](https://github.com/symfony/symfony/pull/18691#issuecomment-218803903), found while reviewing AutowirePass in 2.8 and 3.2 and wondering about the delta. Should reduce future merge conflicts and help history tracking.
Commits
-------
dd5236a [DI] Align AutowirePass with 2.8
This PR was merged into the 3.2 branch.
Discussion
----------
Improve tracking of environment variables in the case of private services
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21273
| License | MIT
Recently, I stumbled upon an issue with environment variables that I had troubles to understand. Here it is:
I have two environment variables, defined in my `parameters.yml` with a default value of empty:
``` yaml
parameters:
env(MAILJET_PUBLIC_KEY): ''
env(MAILJET_PRIVATE_KEY): ''
```
I use these variables only in a private service:
``` xml
<service id="app.mailjet.transport" class="AppBundle\Mailjet\MailjetApiTransport" public="false">
<argument type="service" id="csa_guzzle.client.mailjet_api"/>
<argument>%env(MAILJET_PUBLIC_KEY)%</argument>
<argument>%env(MAILJET_PRIVATE_KEY)%</argument>
</service>
```
This private service is not used by any other service for the moment.
As the service is private and not used by any other service, the `RemoveUnusedDefinitionsPass` removes it from the container. However, when the container dumper dumps the container, it checks if the environment variable was dumped. As the service is now gone, an expection is thrown (`EnvParameterException, Incompatible use of dynamic environment variables "MAILJET_PUBLIC_KEY", "MAILJET_PRIVATE_KEY" found in parameters.`).
Commits
-------
f380ba3 Improve tracking of environment variables in the case of private services
This PR was merged into the 2.7 branch.
Discussion
----------
[Validator] property constraints can be added in child classes
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21538, #21567
| License | MIT
| Doc PR |
This reverts the changes done in #21053 (and applies the test written by @angelk in #21538). I think trying to "fix" #15950 with the changes from #21053 was a mistake. Child classes should be able to refine validation constraints (I basically agree with @ro0NL's reasoning in https://github.com/symfony/symfony/issues/21567#issuecomment-278729990.
Commits
-------
9513a8aa52 property constraints can be added in child classes
a266ff799c added test for staticClassLoader in LazyLoadingMetadatafactory
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DependencyInjection] Add support for named arguments
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | todo
This PR introduces named arguments for services definitions. It's especially useful to inject parameters in an autowired service. It is (at least partially) an alternative to #21376 and #20738.
Usage:
```yml
services:
_defaults: { autowire: true }
Acme\NewsletterManager: { $apiKey: "%mandrill_api_key%" }
# Alternative (traditional) syntax
services:
newsletter_manager:
class: Acme\NewsletterManager
arguments:
$apiKey: "%mandrill_api_key%"
autowire: true
```
```php
use Doctrine\ORM\EntityManager;
use Psr\Log\LoggerInterface;
namespace Acme;
class NewsletterManager
{
private $logger;
private $em;
private $apiKey;
public function __construct(LoggerInterface $logger, EntityManager $em, $apiKey)
{
$this->logger = $logger;
$this->em = $em;
$this->apiKey = $apiKey;
}
}
```
Commits
-------
8a126c8537 [DI] Deprecate string keys in arguments
2ce36a6074 [DependencyInjection] Add a new pass to check arguments validity
6e501296f9 [DependencyInjection] Add support for named arguments
This PR was squashed before being merged into the 3.3-dev branch (closes#19371).
Discussion
----------
[Serializer] Give access to the context to support* methods
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no (?) |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | n/a |
This is a current use case to want to access the context form the `supports*` methods. This PR fixes this limitation.
Maybe can it be considered a bug fix?
Commits
-------
6a7a16e517 [Serializer] Give access to the context to support* methods
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Replace container injection by explicit service locators
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20658
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/7458
This adds a new `ServiceLocatorArgument` (`!service_locator`) argument type which takes a list of services, meant to be used as a concrete service locator in order to avoid the remaining needs for injecting the container when it's only a matter of dependency lazy-loading.
Config:
```yaml
App\FooBar: [!service_locator { key1: '@service1', key2: '@service2' }]
```
```xml
<service class="App\FooBar" public="false">
<argument type="service-locator">
<argument type="service" key="key1" id="service1"/>
<argument type="service" key="key2" id="service2"/>
</argument>
</service>
```
```php
new ServiceLocatorArgument(array('key1' => new Reference('service1'), 'key2' => new Reference('service2'));
```
Usage:
```php
$locator->has('key1') // true
$locator->has('service1') // false, the defined key must be used
$locator->get('key1'); // service1 instance
$locator->get('service1'); // exception
$locator->has('not-specified') // false
$locator->get('not-specified'); // exception
```
We have some concrete use cases in the core where this would be useful (see e.g. SecurityBundle's FirewallMap), same in userland/3rd party code (see related RFC).
Commits
-------
e7935c0adb [DI] Replace container injection by explicit service locators
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Serializer] Add the possibility to filter attributes
| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | n/a |
| License | MIT |
| Doc PR | todo |
This new features give the possibility to the end user to select select fields to normalize.
Exemple:
``` php
class Foo
{
public $a = '1';
public $b = '2';
public $c = '3';
}
$normalizer = new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer();
$normalizer->normalize(new Foo(), null, ['attributes' => ['a', 'c']]);
// ['a' => '1', 'c' => '3']
```
Denormalization is also supported. This feature works for any normalizer using the `Symfony\Component\Serializer\Normalizer\AbstractNormalizer` class.
The main use case is to permit to API clients to optimize responses length by dropping unnecessary information like in the following example:
```
http://exemple.com/cars?fields=a,c
{'a' => 1, 'c' => 2}
```
Thanks to this PR, support for this feature will be available out of the box in [API Platform](https://api-platform.com).
Commits
-------
b3826fb0e7 [Serializer] Add the possibility to filter attributes
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Add prototype services for PSR4-based discovery and registration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | to be done
Talking with @dunglas, we wondered if this could be a good idea, as a more general approach to folder-based service registration as done in [DunglasActionBundle](https://github.com/dunglas/DunglasActionBundle/blob/master/DependencyInjection/DunglasActionExtension.php).
So here is the implementation.
This allows one to define a set of services as such:
```yaml
services:
App\:
resources: ../src/{Controller,Command} # relative to the current file as usual
autowire: true # or any other attributes really
```
This looks for php files in the "src" folder, derivates PSR-4 class names from them, and uses `class_exists` for final discovery. The resulting services are named after the classes found this way.
The "resource" attribute can be a glob to select only a subset of the classes/files.
This approach has several advantages over [DunglasActionBundle](https://github.com/dunglas/DunglasActionBundle/blob/master/DependencyInjection/DunglasActionExtension.php):
- it is resilient to missing parent classes (see test case)
- it loads classes using the normal code path (the autoloader), thus play well with them (e.g. if one registered a special autoloader).
- it is more predictable, because it uses discovered paths as the only source of ids/classes to register - vs relying on `get_declared_classes`, which would make things context sensitive.
Fits well with current initiatives to me.
Commits
-------
03470b788e [DI] Add "psr4" service attribute for PSR4-based discovery and registration
This PR was squashed before being merged into the 3.3-dev branch (closes#21465).
Discussion
----------
[Debug] Support `@final` on methods
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21461#discussion_r98401148
| License | MIT
| Doc PR |
This adds support for `@final` on methods:
```php
class Foo {
/**
* @final since version 2.0.
*/
public function bar()
{
}
}
```
ping @nicolas-grekas
Commits
-------
1b0a6b6c45 [Debug] Support on methods
This PR was merged into the 3.3-dev branch.
Discussion
----------
Secure unserialize by restricting allowed classes when using PHP 7
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ---
| License | MIT
| Doc PR | ---
While playing around with Symfony in a PHP 7.1 application I noticed a warning in how EnvParameterResoure uses unserialize. Since PHP 7.0 introduced the options argument which allows to restrict which classes can be unserialized for better security, it might make sense to use it here. As far as I can tell this is no BC break, it only provides an additional safety mechanism.
Commits
-------
b4201810b9 Conditionally add options to unserialize in PHP 7.0+.
This PR was squashed before being merged into the 2.7 branch (closes#21458).
Discussion
----------
[Config] Early return for DirectoryResource
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | sure?
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets |
| Related PRs | #21440
| License | MIT
| Doc PR | n/a
Alternate PR that implements an early return for `DirectoryResource` to increase the speed on large file sets. We can never return early with `true` without checking all assets within the resource, as the aforementioned referenced PR did; hence this PR takes the counter approach and returns `false` early where appropriate.
_Conversation about possible bug at https://github.com/symfony/symfony/pull/21458#discussion_r98366339._
Commits
-------
d5746ecfd2 fix directory resource considers same timestamp not fresh
96107e21f1 return false early from directory resource
This PR was merged into the 2.7 branch.
Discussion
----------
[DoctrineBridge] make sure that null can be the invalid value
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21554
| License | MIT
| Doc PR |
Commits
-------
c3702c2d8f make sure that null can be the invalid value
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Config][DI] Add ComposerResource to track the runtime engine + deps
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
So that the container is invalidated whenever a new PHP runtime is used, a PHP-extension is added, or vendors are changed.
Commits
-------
a960c761d1 [Config][DI] Add ComposerResource to track runtime + vendors
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Deprecate (un)setting pre-defined services
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | no
| Fixed tickets | #19192
| License | MIT
| Doc PR | -
This PR is the subset of #19668 that fixes#19192: it deprecates (un)setting pre-defined services.
This opens the path to some optimizations in the dumped container in 4.0.
Commits
-------
fdb2140b81 [DI] Deprecate (un)setting pre-defined services
This PR was merged into the 3.2 branch.
Discussion
----------
[FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21549
| License | MIT
| Doc PR | -
Related to #21381 which disabled any cache at bootstrap.
Instead, this wires ArrayCache during bootstrapping, then swaps the cache provider for the real one.
Commits
-------
f90f53e915 [FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap
This PR was merged into the 2.8 branch.
Discussion
----------
[WebProfilerBundle] Readd Symfony version status in the toolbar
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
The Symfony version status (*"This Symfony version will no longer receive security fixes."* and the like) was no longer shown in the toolbar. This was removed in 9d89841e3a , but the commit description isn't that describing. I guess it's not done on purpose.
I think having this information is crucial for this feature to work: A yellow version doesn't mean anything specific, unless I see "This Symfony will only receive security fixes".
/cc @javiereguiluz
Commits
-------
d714c7e Readd Symfony version status in the toolbar
This PR was squashed before being merged into the 3.3-dev branch (closes#21194).
Discussion
----------
[Yaml] Add tags support
| 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/issues/21185
| License | MIT
| Doc PR |
This PR adds custom tags support to the Yaml component.
Symfony tags (`!!binary`, `!str`, etc.) are still managed in the parser to have a lighter diff but we'll be able to convert them later if we want to.
The primary addition of this PR is the `TagInterface`:
```php
interface TagInterface
{
public function construct(mixed $value): mixed;
}
```
It can be used to register custom tags. An example that could be used to convert [the syntax `=iterator`](https://github.com/symfony/symfony/pull/20907#issuecomment-270728216) to a tag:
```php
final class IteratorTag implements TagInterface
{
public function construct(mixed $value): mixed
{
return new IteratorArgument($value);
}
}
$parser = new Parser(['iterator' => new IteratorTag()]);
```
If you think this is too complex, @nicolas-grekas [proposed an alternative](https://github.com/symfony/symfony/issues/21185#issuecomment-271074840) to my proposal externalizing this support by introducing a new class `TaggedValue`.
Commits
-------
4744107 [Yaml] Add tags support
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] ContainerBuilder::compile() can optionally resolve env vars in parameter bag
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #21420
| License | MIT
| Doc PR | -
Here is a new feature allowing one to do `$container->compile(true)` and get the env vars resolved using the current env.
Commits
-------
a3fd512271 [DI] ContainerBuilder::compile() can optionally resolve env vars in parameter bag
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Implement PSR-11
TODO:
- [x] wait for a stable version of the psr/container package;
- [x] ~~deprecate instanciating ServiceNotFoundException directly, or using any of its methods directly;~~ not relevant anymore
- [x] act on the outcome of https://github.com/php-fig/container/issues/8 (solved in https://github.com/php-fig/container/issues/9) ;
- [x] ~~solve the mandatory NotFoundExceptionInterface on non-existing service
problem (with a flag ?);~~ non-issue, see comments below
- [x] provide meta-package psr/container-implementation if all problems can
be solved.
| Q | A
| ------------- | ---
| Branch? | master
| New feature? | yes
| BC breaks? | not at the moment
| Tests pass? | didn't pass before pushing, or even starting to code, will see Travis
| License | MIT
| Doc PR | TODO
This PR is a first attempt at implementing PSR-11, or at least trying to get closer to it.
Delegate lookup is optional, and thus not implemented for now.
Commits
-------
bde0efd01c Implement PSR-11
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Process] Accept command line arrays and per-run env vars, fixing signaling and escaping
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #12488, #11972, #10025, #11335, #5759, #5030, #19993, #10486
| License | MIT
| Doc PR | -
I think I found a way to fix this network of issues once for all.
Of all the linked ones, only the last two are still open: the remaining were closed in dead ends.
Instead of trying to make `ProcessUtil::escapeArgument` work correctly on Windows - which is impossible as discussed in #21347 - this PR deprecates it in favor of a more powerful approach.
Depending on the use case:
- when a simple command should be run, `Process` now accepts an array of arguments (the "binary" being the first arg). Making this the responsibility of `Process` (instead of `ProcessBuilder`) gives two benefits:
- escape becomes an internal detail that doesn't leak - thus can't be misused ([see here](https://github.com/symfony/symfony/pull/21347#issuecomment-274051370))
- since we know we're running a single command, we can prefix it automatically by "exec" - thus fixing a long standing issue with signaling
```php
$p = new Process(array('php', '-r', 'echo 123;'));
echo $p->getCommandLine();
// displays on Linux:
// exec 'php' '-r' 'echo 123;'
```
- when a shell expression is required, passing a string is still allowed. To make it easy and look-like sql prepared statements, env vars can be used when running the command. Since the shell is OS-specific (think Windows vs Linux) - this PR assumes no portability, so one should just use each shell's specific syntax.
From the fixtures:
```php
$env = array('FOO' => 'Foo', 'BAR' => 'Bar');
$cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
$p = new Process($cmd, null, $env);
$p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ'));
$this->assertSame('Foo baR baZ', rtrim($p->getOutput()));
$this->assertSame($env, $p->getEnv());
```
Commits
-------
330b61fecb [Process] Accept command line arrays and per-run env vars, fixing signaling and escaping
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Refacto / cleanup / minor fixes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
An almost neutral refacto touching only new things in master - unlocking some next steps.
- renames "autowire method" to "autowire call"
- renames `GetterProxyInterface` to `InheritanceProxyInterface`
- moves some helpers in a new internal `InheritanceProxyHelper`
- some other minor things
Commits
-------
ad5b5b5d93 [DI] Refacto / cleanup / minor fixes