8000 Merge branch '5.0' · symfony/symfony@2b97a0f · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b97a0f

Browse files
author
Robin Chalas
committed
Merge branch '5.0'
* 5.0: (47 commits) reset the kernel cache after each test [HttpKernel] Ability to define multiple kernel.reset tags [Routing] Continue supporting single colon in object route loaders [FWBundle] Remove unused parameter [Intl] [Workflow] fixes English grammar typos [Filesystem] [Serializer] fixes English grammar typo mailer: mailchimp bridge is throwing undefined index _id when setting message id in mandrill http transport has_roles should be is_granted in security upgrade file has_roles should be is_granted in upgrade files [HttpClient] Fix early cleanup of pushed HTTP/2 responses skip test on incompatible PHP versions [HttpKernel] Don't cache "not-fresh" state Drop WebServerBundle directory [FrameworkBundle][Cache] Don't deep-merge cache pools configuration [Messenger] Adding exception to amqp transport in case amqp ext is not installed [SecurityBundle] Don't require a user provider for the anonymous listener [DoctrineBridge] Fixed cs in DoctrineType [Monolog Bridge] Fixed accessing static property as non static. Improve Symfony description [Mailer] Add UPGRADE entries about Envelope and MessageEvent ...
2 parents 7719fc7 + e5f0e60 commit 2b97a0f

File tree

67 files changed

+699
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+699
-153
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ before_install:
141141
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
142142
fi
143143
144+
- |
145+
# Install vulcain
146+
wget https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz
147+
sudo mv vulcain /usr/local/bin
148+
docker pull php:7.3-alpine
149+
144150
- |
145151
# php.ini configuration
146152
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
@@ -306,8 +312,14 @@ install:
306312
PHPUNIT_X="$PHPUNIT_X,legacy"
307313
fi
308314
315+
if [[ $PHP = ${MIN_PHP%.*} ]]; then
316+
tfold src/Symfony/Component/HttpClient.h2push docker run -it --rm -v $(pwd):/app -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.3-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
317+
fi
318+
309319
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
320+
310321
tfold src/Symfony/Component/Console.tty $PHPUNIT --group tty
322+
311323
if [[ $PHP = ${MIN_PHP%.*} ]]; then
312324
export PHP=$MIN_PHP
313325
tfold src/Symfony/Component/Process.sigchild SYMFONY_DEPRECATIONS_HELPER=weak php-$MIN_PHP/sapi/cli/php ./phpunit --colors=always src/Symfony/Component/Process/

CHANGELOG-4.4.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ in 4.4 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.4.0...v4.4.1
99

10+
* 4.4.0 (2019-11-21)
11+
12+
* bug #34464 [Form] group constraints when calling the validator (nicolas-grekas)
13+
* bug #34451 [DependencyInjection] Fix dumping multiple deprecated aliases (shyim)
14+
* bug #34448 [Form] allow button names to start with uppercase letter (xabbuh)
15+
* bug #34428 [Security] Fix best encoder not wired using migrate_from (chalasr)
16+
1017
* 4.4.0-RC1 (2019-11-17)
1118

1219
* bug #34419 [Cache] Disable igbinary on PHP >= 7.4 (nicolas-grekas)

CHANGELOG-5.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ in 5.0 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.0.0...v5.0.1
99

10+
* 5.0.0 (2019-11-21)
11+
12+
* bug #34464 [Form] group constraints when calling the validator (nicolas-grekas)
13+
* bug #34451 [DependencyInjection] Fix dumping multiple deprecated aliases (shyim)
14+
* bug #34448 [Form] allow button names to start with uppercase letter (xabbuh)
15+
* bug #34434 [Routing] Fix ContainerLoader and ObjectLoaderTest (fancyweb)
16+
* bug #34428 [Security] Fix best encoder not wired using migrate_from (chalasr)
17+
1018
* 5.0.0-RC1 (2019-11-17)
1119

1220
* bug #34419 [Cache] Disable igbinary on PHP >= 7.4 (nicolas-grekas)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src="https://symfony.com/logos/symfony_black_02.svg">
33
</a></p>
44

5-
[Symfony][1] is a **PHP framework** for web applications and a set of reusable
5+
[Symfony][1] is a **PHP framework** for web and console applications and a set of reusable
66
**PHP components**. Symfony is used by thousands of web applications (including
77
BlaBlaCar.com and Spotify.com) and most of the [popular PHP projects][2] (including
88
Drupal and Magento).

UPGRADE-4.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Security
230230

231231
**After**
232232
```php
233-
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
233+
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {}
234234
235235
// or:
236236
if ($this->authorizationChecker->isGranted('ROLE_USER')

UPGRADE-5.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ Security
410410

411411
**After**
412412
```php
413-
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
413+
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {}
414414
415415
// or:
416416
if ($this->authorizationChecker->isGranted('ROLE_USER')
@@ -473,6 +473,7 @@ Security
473473
* Classes implementing the `TokenInterface` must implement the two new methods
474474
`__serialize` and `__unserialize`
475475
* Implementations of `Guard\AuthenticatorInterface::checkCredentials()` must return a boolean value now. Please explicitly return `false` to indicate invalid credentials.
476+
* Removed the `has_role()` function from security expressions, use `is_granted()` instead.
476477

477478
SecurityBundle
478479
--------------

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
5050
*
5151
* For backwards compatibility, objects are cast to strings by default.
5252
*
53-
*
5453
* @internal This method is public to be usable as callback. It should not
5554
* be used in user code.
5655
*/
@@ -143,8 +142,7 @@ public function configureOptions(OptionsResolver $resolver)
143142
$options['em'],
144143
$options['class'],
145144
$options['id_reader'],
146-
$entityLoader,
147-
false
145+
$entityLoader
148146
);
149147

150148
if (null !== $hash) {

src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function onKernelResponse(ResponseEvent $event)
4141
}
4242

4343
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
44-
$this->sendHeaders = false;
44+
self::$sendHeaders = false;
4545
$this->headers = [];
4646

4747
return;
@@ -59,7 +59,7 @@ public function onKernelResponse(ResponseEvent $event)
5959
*/
6060
protected function sendHeader($header, $content): void
6161
{
62-
if (!$this->sendHeaders) {
62+
if (!self::$sendHeaders) {
6363
return;
6464
}
6565

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CHANGELOG
4545
* Added new `error_controller` configuration to handle system exceptions
4646
* Added sort option for `translation:update` command.
4747
* [BC Break] The `framework.messenger.routing.senders` config key is not deeply merged anymore.
48-
* Added `secrets:*` commands and `%env(secret:...)%` processor to deal with secrets seamlessly.
48+
* Added `secrets:*` commands to deal with secrets seamlessly.
4949
* Made `framework.session.handler_id` accept a DSN
5050
* Marked the `RouterDataCollector` class as `@final`.
5151
* [BC Break] The `framework.messenger.buses.<name>.middleware` config key is not deeply merged anymore.

src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ private function getContainerBuilder(): ContainerBuilder
7070
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
7171
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
7272
$container = $buildContainer();
73-
$container->getCompilerPassConfig()->setRemovingPasses([]);
7473
} else {
7574
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
7675
}

src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6464
{
6565
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
6666

67-
$io->comment('Use <info>"%env(secret:<name>)%"</info> to reference a secret in a config file.');
67+
$io->comment('Use <info>"%env(<name>)%"</info> to reference a secret in a config file.');
6868

6969
if (!$reveal = $input->getOption('reveal')) {
7070
$io->comment(sprintf('To reveal the secrets run <info>php %s %s --reveal</info>', $_SERVER['PHP_SELF'], $this->getName()));

src/Symfony/Bundle/FrameworkBundle/Command/SecretsSetCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function configure()
5656
<info>%command.full_name% <name></info>
5757
5858
To reference secrets in services.yaml or any other config
59-
files, use <info>"%env(secret:<name>)%"</info>.
59+
files, use <info>"%env(<name>)%"</info>.
6060
6161
By default, the secret value should be entered interactively.
6262
Alternatively, provide a file where to read the secret from:

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
2020
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
2121
use Symfony\Component\Config\Definition\ConfigurationInterface;
22+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2223
use Symfony\Component\DependencyInjection\Exception\LogicException;
2324
use Symfony\Component\Form\Form;
2425
use Symfony\Component\HttpClient\HttpClient;
@@ -877,6 +878,7 @@ private function addCacheSection(ArrayNodeDefinition $rootNode)
877878
->end()
878879
->children()
879880
->arrayNode('adapters')
881+
->performNoDeepMerging()
880882
->info('One or more adapters to chain for creating the pool, defaults to "cache.app".')
881883
->beforeNormalization()
882884
->always()->then(function ($values) {
@@ -1035,6 +1037,10 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
10351037
->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus']; })
10361038
->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
10371039
->end()
1040+
->validate()
1041+
->ifTrue(static function ($v): bool { return isset($v['buses']) && null !== $v['default_bus'] && !isset($v['buses'][$v['default_bus']]); })
1042+
->then(static function (array $v): void { throw new InvalidConfigurationException(sprintf('The specified default bus "%s" is not configured. Available buses are "%s".', $v['default_bus'], implode('", "', array_keys($v['buses'])))); })
1043+
->end()
10381044
->children()
10391045
->arrayNode('routing')
10401046
->normalizeKeys(false)

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function load(array $configs, ContainerBuilder $container)
302302
}
303303

304304
if ($this->messengerConfigEnabled = $this->isConfigEnabled($container, $config['messenger'])) {
305-
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['serializer'], $config['validation']);
305+
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['validation']);
306306
} else {
307307
$container->removeDefinition('console.command.messenger_consume_messages');
308308
$container->removeDefinition('console.command.messenger_debug');
@@ -1558,7 +1558,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
15581558
}
15591559
}
15601560

1561-
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $serializerConfig, array $validationConfig)
1561+
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $validationConfig)
15621562
{
15631563
if (!interface_exists(MessageBusInterface::class)) {
15641564
throw new LogicException('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger".');
@@ -1941,7 +1941,9 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
19411941

19421942
// as we have a bus, the channels don't need the transports
19431943
$container->getDefinition('notifier.channel.chat')->setArgument(0, null);
1944-
$container->getDefinition('notifier.channel.email')->setArgument(0, null);
1944+
if ($container->hasDefinition('notifier.channel.email')) {
1945+
$container->getDefinition('notifier.channel.email')->setArgument(0, null);
1946+
}
19451947
$container->getDefinition('notifier.channel.sms')->setArgument(0, null);
19461948
}
19471949

src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
<tag name="serializer.normalizer" priority="-915" />
4141
</service>
4242

43+
<service id="serializer.normalizer.datetimezone" class="Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer">
44+
<!-- Run before serializer.normalizer.object -->
45+
<tag name="serializer.normalizer" priority="-915" />
46+
</service>
47+
4348
<service id="serializer.normalizer.dateinterval" class="Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer">
4449
<!-- Run before serializer.normalizer.object -->
4550
<tag name="serializer.normalizer" priority="-915" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,27 @@ public function testBusMiddlewareDontMerge()
314314
);
315315
}
316316

317+
public function testItErrorsWhenDefaultBusDoesNotExist()
318+
{
319+
$processor = new Processor();
320+
$configuration = new Configuration(true);
321+
322+
$this->expectException(InvalidConfigurationException::class);
323+
$this->expectExceptionMessage('The specified default bus "foo" is not configured. Available buses are "bar", "baz".');
324+
325+
$processor->processConfiguration($configuration, [
326+
[
327+
'messenger' => [
328+
'default_bus' => 'foo',
329+
'buses' => [
330+
'bar' => null,
331+
'baz' => null,
332+
],
333+
],
334+
],
335+
]);
336+
}
337+
317338
protected static function getBundleDefaultConfig()
318339
{
319340
return [

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ private function createAuthenticationListeners(ContainerBuilder $container, stri
459459
throw new InvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall[$key]['provider']));
460460
}
461461
$userProvider = $providerIds[$normalizedName];
462-
} elseif ('remember_me' === $key) {
463-
// RememberMeFactory will use the firewall secret when created
462+
} elseif ('remember_me' === $key || 'anonymous' === $key) {
463+
// RememberMeFactory will use the firewall secret when created, AnonymousAuthenticationListener does not load users.
464464
$userProvider = null;
465465
} elseif ($defaultProvider) {
466466
$userProvider = $defaultProvider;

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testMissingProviderForListener()
210210
$container->compile();
211211
}
212212

213-
public function testPerListenerProviderWithRememberMe()
213+
public function testPerListenerProviderWithRememberMeAndAnonymous()
214214
{
215215
$container = $this->getRawContainer();
216216
$container->loadFromExtension('security', [
@@ -223,6 +223,7 @@ public function testPerListenerProviderWithRememberMe()
223223
'default' => [
224224
'form_login' => ['provider' => 'second'],
225225
'remember_me' => ['secret' => 'baz'],
226+
'anonymous' => true,
226227
],
227228
],
228229
]);

src/Symfony/Bundle/WebServerBundle/.gitattributes

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0