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
This commit is contained in:
commit
483a274994
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if (!file_exists(__DIR__.'/src')) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
return PhpCsFixer\Config::create()
|
return PhpCsFixer\Config::create()
|
||||||
->setRules(array(
|
->setRules(array(
|
||||||
'@Symfony' => true,
|
'@Symfony' => true,
|
||||||
|
@ -115,8 +115,8 @@ abstract class KernelTestCase extends TestCase
|
|||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SERVER['KERNEL_DIR'])) {
|
if (isset($_SERVER['KERNEL_DIR']) || isset($_ENV['KERNEL_DIR'])) {
|
||||||
$dir = $_SERVER['KERNEL_DIR'];
|
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : $_ENV['KERNEL_DIR'];
|
||||||
|
|
||||||
if (!is_dir($dir)) {
|
if (!is_dir($dir)) {
|
||||||
$phpUnitDir = static::getPhpUnitXmlDir();
|
$phpUnitDir = static::getPhpUnitXmlDir();
|
||||||
|
@ -122,12 +122,11 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
|
|||||||
return $targetUrl;
|
return $targetUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->options['use_referer']) {
|
if ($this->options['use_referer'] && $targetUrl = $request->headers->get('Referer')) {
|
||||||
$targetUrl = $request->headers->get('Referer');
|
|
||||||
if (false !== $pos = strpos($targetUrl, '?')) {
|
if (false !== $pos = strpos($targetUrl, '?')) {
|
||||||
$targetUrl = substr($targetUrl, 0, $pos);
|
$targetUrl = substr($targetUrl, 0, $pos);
|
||||||
}
|
}
|
||||||
if ($targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
|
if ($targetUrl && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) {
|
||||||
return $targetUrl;
|
return $targetUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,16 @@ class DefaultAuthenticationSuccessHandlerTest extends TestCase
|
|||||||
array(),
|
array(),
|
||||||
'/',
|
'/',
|
||||||
),
|
),
|
||||||
|
'target path as referer when referer not set' => array(
|
||||||
|
Request::create('/'),
|
||||||
|
array('use_referer' => true),
|
||||||
|
'/',
|
||||||
|
),
|
||||||
|
'target path as referer when referer is ?' => array(
|
||||||
|
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => '?')),
|
||||||
|
array('use_referer' => true),
|
||||||
|
'/',
|
||||||
|
),
|
||||||
'target path should be different than login URL' => array(
|
'target path should be different than login URL' => array(
|
||||||
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => 'http://localhost/login')),
|
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => 'http://localhost/login')),
|
||||||
array('use_referer' => true, 'login_path' => '/login'),
|
array('use_referer' => true, 'login_path' => '/login'),
|
||||||
|
Reference in New Issue
Block a user