Skip to content

Commit 36b04ce

Browse files
Merge branch '4.3' into 4.4
* 4.3: Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)" [Form][PropertyPathMapper] Avoid extra call to get config [HttpKernel] remove unused fixtures
2 parents 88674ad + 416bc9c commit 36b04ce

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
@@ -916,22 +916,13 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
916916

917917
// session handler (the internal callback registered with PHP session management)
918918
if (null === $config['handler_id']) {
919-
// If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored
920-
if (isset($config['save_path'])) {
921-
throw new LogicException('Session save path is ignored without a handler service');
922-
}
923-
924919
// Set the handler class to be null
925920
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
926921
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
927922
} else {
928923
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
929924
}
930925

931-
if (!isset($config['save_path'])) {
932-
$config['save_path'] = ini_get('session.save_path');
933-
}
934-
935926
$container->setParameter('session.save_path', $config['save_path']);
936927

937928
$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
@@ -294,6 +294,7 @@ protected static function getBundleDefaultConfig()
294294
'cookie_httponly' => true,
295295
'cookie_samesite' => null,
296296
'gc_probability' => 1,
297+
'save_path' => '%kernel.cache_dir%/sessions',
297298
'metadata_update_threshold' => 0,
298299
],
299300
'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
@@ -554,12 +554,6 @@ public function testNullSessionHandler()
554554
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
555555
}
556556

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

0 commit comments

Comments
 (0)