Skip to content

Commit 4f9de44

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: do not mock the session in token storage tests Add Occitan plural rule Fix security/* cross-dependencies Disallow illegal characters like "." in session.name fix rounding from string
2 parents 02c5d71 + 5a18e3f commit 4f9de44

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

DependencyInjection/Configuration.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,16 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
461461
->children()
462462
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
463463
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
464-
->scalarNode('name')->end()
464+
->scalarNode('name')
465+
->validate()
466+
->ifTrue(function ($v) {
467+
parse_str($v, $parsed);
468+
469+
return implode('&', array_keys($parsed)) !== (string) $v;
470+
})
471+
->thenInvalid('Session name %s contains illegal character(s)')
472+
->end()
473+
->end()
465474
->scalarNode('cookie_lifetime')->end()
466475
->scalarNode('cookie_path')->end()
467476
->scalarNode('cookie_domain')->end()

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,55 @@ public function testTrustedProxiesSetToNonEmptyArrayIsInvalid()
7979

8080
/**
8181
* @group legacy
82+
* @dataProvider getTestValidSessionName
83+
*/
84+
public function testValidSessionName($sessionName)
85+
{
86+
$processor = new Processor();
87+
$config = $processor->processConfiguration(
88+
new Configuration(true),
89+
array(array('session' => array('name' => $sessionName)))
90+
);
91+
92+
$this->assertEquals($sessionName, $config['session']['name']);
93+
}
94+
95+
public function getTestValidSessionName()
96+
{
97+
return array(
98+
array(null),
99+
array('PHPSESSID'),
100+
array('a&b'),
101+
array(',_-!@#$%^*(){}:<>/?'),
102+
);
103+
}
104+
105+
/**
106+
* @dataProvider getTestInvalidSessionName
107+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
108+
*/
109+
public function testInvalidSessionName($sessionName)
110+
{
111+
$processor = new Processor();
112+
$processor->processConfiguration(
113+
new Configuration(true),
114+
array(array('session' => array('name' => $sessionName)))
115+
);
116+
}
117+
118+
public function getTestInvalidSessionName()
119+
{
120+
return array(
121+
array('a.b'),
122+
array('a['),
123+
array('a[]'),
124+
array('a[b]'),
125+
array('a=b'),
126+
array('a+b'),
127+
);
128+
}
129+
130+
/**
82131
* @dataProvider getTestValidTrustedProxiesData
83132
*/
84133
public function testValidTrustedProxies($trustedProxies, $processedProxies)

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@
3939
"symfony/css-selector": "~2.8|~3.0|~4.0",
4040
"symfony/dom-crawler": "~2.8|~3.0|~4.0",
4141
"symfony/polyfill-intl-icu": "~1.0",
42-
"symfony/security": "~2.8|~3.0|~4.0",
4342
"symfony/form": "~3.4|~4.0",
4443
"symfony/expression-language": "~2.8|~3.0|~4.0",
4544
"symfony/process": "~2.8|~3.0|~4.0",
4645
"symfony/security-core": "~3.2|~4.0",
47-
"symfony/security-csrf": "~2.8|~3.0|~4.0",
46+
"symfony/security-csrf": "^2.8.31|^3.3.13|~4.0",
4847
"symfony/serializer": "~3.3|~4.0",
4948
"symfony/stopwatch": "~3.4|~4.0",
5049
"symfony/translation": "~3.4|~4.0",

0 commit comments

Comments
 (0)