8000 Merge branch '2.8' into 3.3 · symfony/symfony@483a274 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 483a274

Browse files
Merge branch '2.8' into 3.3
* 2.8: Revert "bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)" [Filesystem] skip tests if not applicable [Fabbot] Do not run php-cs-fixer if there are no change in src/ [Security] Fix exception when use_referer option is true and referer is not set or empty Get KERNEL_DIR through $_ENV too for KernelTestCase check permissions if dump target dir is missing
2 parents 1c04cd5 + d6dfb5b commit 483a274

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.php_cs.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
if (!file_exists(__DIR__.'/src')) {
4+
exit(0);
5+
}
6+
37
return PhpCsFixer\Config::create()
48
->setRules(array(
59
'@Symfony' => true,

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ protected static function getKernelClass()
115115
return $class;
116116
}
117117

118-
if (isset($_SERVER['KERNEL_DIR'])) {
119-
$dir = $_SERVER['KERNEL_DIR'];
118+
if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) {
119+
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : $_ENV['KERNEL_DIR'];
120120

121121
if (!is_dir($dir)) {
122122
$phpUnitDir = static::getPhpUnitXmlDir();

src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,11 @@ protected function determineTargetUrl(Request $request)
122122
return $targetUrl;
123123
}
124124

125-
if ($this->options['use_referer']) {
126-
$targetUrl = $request->headers->get('Referer');
125+
if ($this->options['use_referer'] && $targetUrl = $request->headers->get('Referer')) {
127126
if (false !== $pos = strpos($targetUrl, '?')) {
128127
$targetUrl = substr($targetUrl, 0, $pos);
129128
}
130-
if ($targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
129+
if ($targetUrl && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
131130
return $targetUrl;
132131
}
133132
}

src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public function getRequestRedirections()
8383
array(),
8484
'/',
8585
),
86+
'target path as referer when referer not set' => array(
87+
Request::create('/'),
88+
array('use_referer' => true),
89+
'/',
90+
),
91+
'target path as referer when referer is ?' => array(
92+
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => '?')),
93+
array('use_referer' => true),
94+
'/',
95+
),
8696
'target path should be different than login URL' => array(
8797
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => 'http://localhost/login')),
8898
array('use_referer' => true, 'login_path' => '/login'),

0 commit comments

Comments
 (0)
0