From 3e2aada2d8bce9ee47994c67b81bee321d4566ba Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Thu, 22 Aug 2019 09:15:31 +0200 Subject: [PATCH 1/2] [Form][PropertyPathMapper] Avoid extra call to get config --- .../Form/Extension/Core/DataMapper/PropertyPathMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php index 92187d772c..657d9d63be 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php +++ b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php @@ -48,7 +48,7 @@ class PropertyPathMapper implements DataMapperInterface if (!$empty && null !== $propertyPath && $config->getMapped()) { $form->setData($this->propertyAccessor->getValue($data, $propertyPath)); } else { - $form->setData($form->getConfig()->getData()); + $form->setData($config->getData()); } } } From 1d7114957baf16033db2f38b5bf6405dce957e68 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 22 Aug 2019 18:27:00 +0200 Subject: [PATCH 2/2] Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" This reverts commit fea98a8473d2116061b31f0e6c90b72e25020cc7, reversing changes made to bd498f2503fb725a0ee509b0de7e70b4f71291d2. --- .../DependencyInjection/Configuration.php | 8 +------- .../DependencyInjection/FrameworkExtension.php | 9 --------- .../Tests/DependencyInjection/ConfigurationTest.php | 1 + .../Fixtures/php/session_savepath.php | 8 -------- .../Fixtures/xml/session_savepath.xml | 12 ------------ .../Fixtures/yml/session_savepath.yml | 4 ---- .../DependencyInjection/FrameworkExtensionTest.php | 6 ------ 7 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 4dfbb0b82d..fab1e3a344 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -470,12 +470,6 @@ class Configuration implements ConfigurationInterface $rootNode ->children() ->arrayNode('session') - ->validate() - ->ifTrue(function ($v) { - return empty($v['handler_id']) && !empty($v['save_path']); - }) - ->thenInvalid('Session save path is ignored without a handler service') - ->end() ->info('session configuration') ->canBeEnabled() ->children() @@ -504,7 +498,7 @@ class Configuration implements ConfigurationInterface ->defaultTrue() ->setDeprecated('The "%path%.%node%" option is enabled by default and deprecated since Symfony 3.4. It will be always enabled in 4.0.') ->end() - ->scalarNode('save_path')->end() + ->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end() ->integerNode('metadata_update_threshold') ->defaultValue('0') ->info('seconds to wait between 2 session metadata updates') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 32ec7933ca..64cdd3003b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -877,11 +877,6 @@ class FrameworkExtension extends Extension // session handler (the internal callback registered with PHP session management) if (null === $config['handler_id']) { - // If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored - if (isset($config['save_path'])) { - throw new LogicException('Session save path is ignored without a handler service'); - } - // Set the handler class to be null $container->getDefinition('session.storage.native')->replaceArgument(1, null); $container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null); @@ -889,10 +884,6 @@ class FrameworkExtension extends Extension $container->setAlias('session.handler', $config['handler_id'])->setPrivate(true); } - if (!isset($config['save_path'])) { - $config['save_path'] = ini_get('session.save_path'); - } - $container->setParameter('session.save_path', $config['save_path']); if (\PHP_VERSION_ID < 70000) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 35c6101537..60a2a8cea6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -374,6 +374,7 @@ class ConfigurationTest extends TestCase 'handler_id' => 'session.handler.native_file', 'cookie_httponly' => true, 'gc_probability' => 1, + 'save_path' => '%kernel.cache_dir%/sessions', 'metadata_update_threshold' => '0', 'use_strict_mode' => true, ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php deleted file mode 100644 index 89841bca43..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php +++ /dev/null @@ -1,8 +0,0 @@ -loadFromExtension('framework', [ - 'session' => [ - 'handler_id' => null, - 'save_path' => '/some/path', - ], -]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml deleted file mode 100644 index a9ddd8016b..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml deleted file mode 100644 index 174ebe5869..0000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml +++ /dev/null @@ -1,4 +0,0 @@ -framework: - session: - handler_id: null - save_path: /some/path diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 1fd0fdba03..431cc0c084 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -465,12 +465,6 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0)); } - public function testNullSessionHandlerWithSavePath() - { - $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); - $this->createContainerFromFile('session_savepath'); - } - public function testRequest() { $container = $this->createContainerFromFile('full');