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
This commit is contained in:
commit
ba784bf430
@ -522,12 +522,6 @@ class Configuration implements ConfigurationInterface
|
|||||||
$rootNode
|
$rootNode
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('session')
|
->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')
|
->info('session configuration')
|
||||||
->canBeEnabled()
|
->canBeEnabled()
|
||||||
->children()
|
->children()
|
||||||
@ -553,7 +547,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->scalarNode('gc_divisor')->end()
|
->scalarNode('gc_divisor')->end()
|
||||||
->scalarNode('gc_probability')->defaultValue(1)->end()
|
->scalarNode('gc_probability')->defaultValue(1)->end()
|
||||||
->scalarNode('gc_maxlifetime')->end()
|
->scalarNode('gc_maxlifetime')->end()
|
||||||
->scalarNode('save_path')->end()
|
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
|
||||||
->integerNode('metadata_update_threshold')
|
->integerNode('metadata_update_threshold')
|
||||||
->defaultValue(0)
|
->defaultValue(0)
|
||||||
->info('seconds to wait between 2 session metadata updates')
|
->info('seconds to wait between 2 session metadata updates')
|
||||||
|
@ -916,11 +916,6 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
// session handler (the internal callback registered with PHP session management)
|
// session handler (the internal callback registered with PHP session management)
|
||||||
if (null === $config['handler_id']) {
|
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
|
// Set the handler class to be null
|
||||||
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
|
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
|
||||||
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
|
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
|
||||||
@ -928,10 +923,6 @@ class FrameworkExtension extends Extension
|
|||||||
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
|
$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.save_path', $config['save_path']);
|
||||||
|
|
||||||
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
|
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
|
||||||
|
@ -294,6 +294,7 @@ class ConfigurationTest extends TestCase
|
|||||||
'cookie_httponly' => true,
|
'cookie_httponly' => true,
|
||||||
'cookie_samesite' => null,
|
'cookie_samesite' => null,
|
||||||
'gc_probability' => 1,
|
'gc_probability' => 1,
|
||||||
|
'save_path' => '%kernel.cache_dir%/sessions',
|
||||||
'metadata_update_threshold' => 0,
|
'metadata_update_threshold' => 0,
|
||||||
],
|
],
|
||||||
'request' => [
|
'request' => [
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$container->loadFromExtension('framework', [
|
|
||||||
'session' => [
|
|
||||||
'handler_id' => null,
|
|
||||||
'save_path' => '/some/path',
|
|
||||||
],
|
|
||||||
]);
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" ?>
|
|
||||||
|
|
||||||
<container xmlns="http://symfony.com/schema/dic/services"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
|
||||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
|
|
||||||
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
|
||||||
|
|
||||||
<framework:config>
|
|
||||||
<framework:session handler-id="null" save-path="/some/path"/>
|
|
||||||
</framework:config>
|
|
||||||
</container>
|
|
@ -1,4 +0,0 @@
|
|||||||
framework:
|
|
||||||
session:
|
|
||||||
handler_id: null
|
|
||||||
save_path: /some/path
|
|
@ -554,12 +554,6 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
|
$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()
|
public function testRequest()
|
||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('full');
|
$container = $this->createContainerFromFile('full');
|
||||||
|
@ -48,7 +48,7 @@ class PropertyPathMapper implements DataMapperInterface
|
|||||||
if (!$empty && null !== $propertyPath && $config->getMapped()) {
|
if (!$empty && null !== $propertyPath && $config->getMapped()) {
|
||||||
$form->setData($this->propertyAccessor->getValue($data, $propertyPath));
|
$form->setData($this->propertyAccessor->getValue($data, $propertyPath));
|
||||||
} else {
|
} else {
|
||||||
$form->setData($form->getConfig()->getData());
|
$form->setData($config->getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user