Skip to content

Commit 2e5a8c8

Browse files
Merge branch '4.3' into 4.4
* 4.3: (26 commits) Fix Twig 1.x compatibility [Translator] Improve farsi(persian) translations for Form Improve fa translations Spell "triggering" properly Added tests to cover the possibility of having scalars as services. fixed tests on old PHP versions [FrameworkBundle] Inform the user when save_path will be ignored fixed CS [SecurityBundle] Fix profiler dump for non-invokable security listeners fixed CS [Messenger] Doctrine Transport: Support setting auto_setup from DSN [Translator] Load plurals from po files properly [Serializer]: AbstractObjectNormalizer ignores the property types of discriminated classes [EventDispatcher] Add tag kernel.rest on 'debug.event_dispatcher' service [Console] Update to inherit and add licence Add missing test for workflow dump description [Intl] Remove --dev from intl compile autoloader [Messenger] fix publishing headers set on AmqpStamp Remove call to deprecated method [Intl] Init compile tmp volume ...
2 parents d3c17f2 + f884d65 commit 2e5a8c8

File tree

54 files changed

+535
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+535
-228
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct($message, array $trace, $file)
7676
// No-op
7777
}
7878
$line = $trace[$i];
79-
$this->trigerringFilePathType = $this->getPathType($file);
79+
$this->triggeringFilePathType = $this->getPathType($file);
8080
if (isset($line['object']) || isset($line['class'])) {
8181
if (isset($line['class']) && 0 === strpos($line['class'], SymfonyTestsListenerFor::class)) {
8282
$parsedMsg = unserialize($this->message);
@@ -88,7 +88,7 @@ public function __construct($message, array $trace, $file)
8888
// then we need to use the serialized information to determine
8989
// if the error has been triggered from vendor code.
9090
if (isset($parsedMsg['triggering_file'])) {
91-
$this->trigerringFilePathType = $this->getPathType($parsedMsg['triggering_file']);
91+
$this->triggeringFilePathType = $this->getPathType($parsedMsg['triggering_file']);
9292
}
9393

9494
return;
@@ -177,10 +177,10 @@ public function isLegacy($utilPrefix)
177177
*/
178178
public function getType()
179179
{
180-
if (self::PATH_TYPE_SELF === $this->trigerringFilePathType) {
180+
if (self::PATH_TYPE_SELF === $this->triggeringFilePathType) {
181181
return self::TYPE_SELF;
182182
}
183-
if (self::PATH_TYPE_UNDETERMINED === $this->trigerringFilePathType) {
183+
if (self::PATH_TYPE_UNDETERMINED === $this->triggeringFilePathType) {
184184
return self::TYPE_UNDETERMINED;
185185
}
186186
$erroringFile = $erroringPackage = null;

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@ 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()
525531
->info('session configuration')
526532
->canBeEnabled()
527533
->children()
@@ -547,7 +553,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
547553
->scalarNode('gc_divisor')->end()
548554
->scalarNode('gc_probability')->defaultValue(1)->end()
549555
->scalarNode('gc_maxlifetime')->end()
550-
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
556+
->scalarNode('save_path')->end()
551557
->integerNode('metadata_update_threshold')
552558
->defaultValue(0)
553559
->info('seconds to wait between 2 session metadata updates')

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

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

901901
// session handler (the internal callback registered with PHP session management)
902902
if (null === $config['handler_id']) {
903+
// If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored
904+
if (isset($config['save_path'])) {
905+
throw new LogicException('Session save path is ignored without a handler service');
906+
}
907+
903908
// Set the handler class to be null
904909
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
905910
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
906911
} else {
907912
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
908913
}
909914

915+
if (!isset($config['save_path'])) {
916+
$config['save_path'] = ini_get('session.save_path');
917+
}
918+
910919
$container->setParameter('session.save_path', $config['save_path']);
911920

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

src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<service id="debug.event_dispatcher" class="Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher" decorates="event_dispatcher">
1111
<tag name="monolog.logger" channel="event" />
12+
<tag name="kernel.reset" method="reset" />
1213
<argument type="service" id="debug.event_dispatcher.inner" />
1314
<argument type="service" id="debug.stopwatch" />
1415
<argument type="service" id="logger" on-invalid="null" />

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ protected static function getBundleDefaultConfig()
301301
'cookie_httponly' => true,
302302
'cookie_samesite' => null,
303303
'gc_probability' => 1,
304-
'save_path' => '%kernel.cache_dir%/sessions',
305304
'metadata_update_threshold' => 0,
306305
],
307306
'request' => [
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'session' => [
5+
'handler_id' => null,
6+
'save_path' => '/some/path',
7+
],
8+
]);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:session handler-id="null" save-path="/some/path"/>
11+
</framework:config>
12+
</container>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
session:
3+
handler_id: null
4+
save_path: /some/path

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,14 @@ public function testNullSessionHandler()
563563
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
564564
}
565565

566+
/**
567+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
568+
*/
569+
public function testNullSessionHandlerWithSavePath()
570+
{
571+
$this->createContainerFromFile('session_savepath');
572+
}
573+
566574
public function testRequest()
567575
{
568576
$container = $this->createContainerFromFile('full');

src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ final class WrappedListener implements ListenerInterface
3939
public function __construct($listener)
4040
{
4141
$this->listener = $listener;
42-
43-
if (null === self::$hasVarDumper) {
44-
self::$hasVarDumper = class_exists(ClassStub::class);
45-
}
4642
}
4743

4844
/**
@@ -76,8 +72,25 @@ public function getWrappedListener()
7672

7773
public function getInfo(): array
7874
{
79-
if (null === $this->stub) {
80-
$this->stub = self::$hasVarDumper ? new ClassStub(\get_class($this->listener)) : \get_class($this->listener);
75+
if (null !== $this->stub) {
76+
// no-op
77+
} elseif (self::$hasVarDumper ?? self::$hasVarDumper = class_exists(ClassStub::class)) {
78+
$this->stub = ClassStub::wrapCallable($this->listener);
79+
} elseif (\is_array($this->listener)) {
80+
$this->stub = (\is_object($this->listener[0]) ? \get_class($this->listener[0]) : $this->listener[0]).'::'.$this->listener[1];
81+
} elseif ($this->listener instanceof \Closure) {
82+
$r = new \ReflectionFunction($this->listener);
83+
if (false !== strpos($r->name, '{closure}')) {
84+
$this->stub = 'closure';
85+
} elseif ($class = $r->getClosureScopeClass()) {
86+
$this->stub = $class->name.'::'.$r->name;
87+
} else {
88+
$this->stub = $r->name;
89+
}
90+
} elseif (\is_string($this->listener)) {
91+
$this->stub = $this->listener;
92+
} else {
93+
$this->stub = \get_class($this->listener).'::__invoke';
8194
}
8295

8396
return [

0 commit comments

Comments
 (0)