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

Skip to content
8000

Commit d6dfb5b

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: 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 e4ce14d + 7793b79 commit d6dfb5b

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
@@ -106,8 +106,8 @@ private static function getPhpUnitCliConfigArgument()
106106
*/
107107
protected static function getKernelClass()
108108
{
109-
if (isset($_SERVER['KERNEL_DIR'])) {
110-
$dir = $_SERVER['KERNEL_DIR'];
109+
if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) {
110+
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : $_ENV['KERNEL_DIR'];
111111

112112
if (!is_dir($dir)) {
113113
$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
@@ -119,12 +119,11 @@ protected function determineTargetUrl(Request $request)
119119
return $targetUrl;
120120
}
121121

122-
if ($this->options['use_referer']) {
123-
$targetUrl = $request->headers->get('Referer');
122+
if ($this->options['use_referer'] && $targetUrl = $request->headers->get('Referer')) {
124123
if (false !== $pos = strpos($targetUrl, '?')) {
125124
$targetUrl = substr($targetUrl, 0, $pos);
126125
}
127-
if ($targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
126+
if ($targetUrl && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
128127
return $targetUrl;
129128
}
130129
}

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