8000 Revert "bug #31620 [FrameworkBundle] Inform the user when save_path w… · symfony/symfony@1d71149 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d71149

Browse files
Revert "bug #31620 [FrameworkBundle] Inform the user when save_path will be ignored (gnat42)"
This reverts commit fea98a8, reversing changes made to bd498f2.
1 parent 118dfa0 commit 1d71149

File tree

7 files changed

+2
-46
lines changed

7 files changed

+2
-46
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,6 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
470470
$rootNode
471471
->children()
472472
->arrayNode('session')
473-
->validate()
474-
->ifTrue(function ($v) {
475-
return empty($v['handler_id']) && !empty($v['save_path']);
476-
})
477-
->thenInvalid('Session save path is ignored without a handler service')
478-
->end()
479473
->info('session configuration')
480474
->canBeEnabled()
481475
->children()
@@ -504,7 +498,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
504498
->defaultTrue()
505499
->setDeprecated('The "%path%.%node%" option is enabled by default and deprecated since Symfony 3.4. It will be always enabled in 4.0.')
506500
->end()
507-
->scalarNode('save_path')->end()
501+
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
508502
->integerNode('metadata_update_threshold')
509503
->defaultValue('0')
510504
->info('seconds to wait between 2 session metadata updates')

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

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

878878
// session handler (the internal callback registered with PHP session management)
879879
if (null === $config['handler_id']) {
880-
// If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored
881-
if (isset($config['save_path'])) {
882-
throw new LogicException('Session save path is ignored without a handler service');
883-
}
884-
885880
// Set the handler class to be null
886881
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
887882
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
888883
} else {
889884
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
890885
}
891886

892-
if (!isset($config['save_path'])) {
893-
$config['save_path'] = ini_get('session.save_path');
894-
}
895-
896887
$container->setParameter('session.save_path', $config['save_path']);
897888

898889
if (\PHP_VERSION_ID < 70000) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ protected static function getBundleDefaultConfig()
374374
'handler_id' => 'session.handler.native_file',
375375
'cookie_httponly' => true,
376376
'gc_probability' => 1,
377+
'save_path' => '%kernel.cache_dir%/sessions',
377378
'metadata_update_threshold' => '0',
378379
'use_strict_mode' => true,
379380
],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php

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

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml

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

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml

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

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,6 @@ public function testNullSessionHandler()
465465
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
466466
}
467467

468-
public function testNullSessionHandlerWithSavePath()
469-
{
470-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
471-
$this->createContainerFromFile('session_savepath');
472-
}
473-
474468
public function testRequest()
475469
{
476470
$container = $this->createContainerFromFile('full');

0 commit comments

Comments
 (0)
0