Skip to content

Commit 416bc9c

Browse files
Merge branch '3.4' into 4.3
* 3.4: Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" [Form][PropertyPathMapper] Avoid extra call to get config
2 parents f5b4937 + 402b739 commit 416bc9c

File tree

7 files changed

+2
-46
lines changed

7 files changed

+2
-46
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,6 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
522522
$rootNode
523523
->children()
524524
->arrayNode('session')
525-
->validate()
526-
->ifTrue(function ($v) {
527-
return empty($v['handler_id']) && !empty($v['save_path']);
528-
})
529-
->thenInvalid('Session save path is ignored without a handler service')
530-
->end()
531525
->info('session configuration')
532526
->canBeEnabled()
533527
->children()
@@ -553,7 +547,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
553547
->scalarNode('gc_divisor')->end()
554548
->scalarNode('gc_probability')->defaultValue(1)->end()
555549
->scalarNode('gc_maxlifetime')->end()
556-
->scalarNode('save_path')->end()
550+
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
557551
->integerNode('metadata_update_threshold')
558552
->defaultValue(0)
559553
->info('seconds to wait between 2 session metadata updates')

DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -892,22 +892,13 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
892892

893893
// session handler (the internal callback registered with PHP session management)
894894
if (null === $config['handler_id']) {
895-
// If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored
896-
if (isset($config['save_path'])) {
897-
throw new LogicException('Session save path is ignored without a handler service');
898-
}
899-
900895
// Set the handler class to be null
901896
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
902897
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
903898
} else {
904899
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
905900
}
906901

907-
if (!isset($config['save_path'])) {
908-
$config['save_path'] = ini_get('session.save_path');
909-
}
910-
911902
$container->setParameter('session.save_path', $config['save_path']);
912903

913904
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ protected static function getBundleDefaultConfig()
293293
'cookie_httponly' => true,
294294
'cookie_samesite' => null,
295295
'gc_probability' => 1,
296+
'save_path' => '%kernel.cache_dir%/sessions',
296297
'metadata_update_threshold' => 0,
297298
],
298299
'request' => [

Tests/DependencyInjection/Fixtures/php/session_savepath.php

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

Tests/DependencyInjection/Fixtures/xml/session_savepath.xml

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

Tests/DependencyInjection/Fixtures/yml/session_savepath.yml

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

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,6 @@ public function testNullSessionHandler()
552552
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
553553
}
554554

555-
public function testNullSessionHandlerWithSavePath()
556-
{
557-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
558-
$this->createContainerFromFile('session_savepath');
559-
}
560-
561555
public function testRequest()
562556
{
563557
$container = $this->createContainerFromFile('full');

0 commit comments

Comments
 (0)