Skip to content

Commit

Permalink
Merge branch '4.3' into 4.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Aug 22, 2019
2 parents 47322db + aeba22c commit ba784bf
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,6 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
$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()
Expand All @@ -553,7 +547,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,22 +916,13 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c

// 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);
} else {
$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']);

$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ protected static function getBundleDefaultConfig()
'cookie_httponly' => true,
'cookie_samesite' => null,
'gc_probability' => 1,
'save_path' => '%kernel.cache_dir%/sessions',
'metadata_update_threshold' => 0,
],
'request' => [
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,6 @@ public function testNullSessionHandler()
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
}

public function testNullSessionHandlerWithSavePath()
{
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
$this->createContainerFromFile('session_savepath');
}

public function testRequest()
{
$container = $this->createContainerFromFile('full');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function mapDataToForms($data, $forms)
if (!$empty && null !== $propertyPath && $config->getMapped()) {
$form->setData($this->propertyAccessor->getValue($data, $propertyPath));
} else {
$form->setData($form->getConfig()->getData());
$form->setData($config->getData());
}
}
}
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit ba784bf

Please sign in to comment.