Merge branch '3.3' into 3.4
* 3.3: 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 [HttpKernel] "controller.service_arguments" services should be public Get KERNEL_DIR through $_ENV too for KernelTestCase Get KERNEL_CLASS through $_ENV too check permissions if dump target dir is missing
This commit is contained in:
commit
b1b686081b
@ -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,
|
||||||
|
@ -114,8 +114,9 @@ abstract class KernelTestCase extends TestCase
|
|||||||
*/
|
*/
|
||||||
protected static function getKernelClass()
|
protected static function getKernelClass()
|
||||||
{
|
{
|
||||||
if (isset($_SERVER['KERNEL_CLASS'])) {
|
if (isset($_SERVER['KERNEL_CLASS']) || isset($_ENV['KERNEL_CLASS'])) {
|
||||||
if (!class_exists($class = $_SERVER['KERNEL_CLASS'])) {
|
$class = isset($_SERVER['KERNEL_CLASS']) ? $_SERVER['KERNEL_CLASS'] : $_ENV['KERNEL_CLASS'];
|
||||||
|
if (!class_exists($class)) {
|
||||||
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
|
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +125,8 @@ abstract class KernelTestCase extends TestCase
|
|||||||
@trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the %1$::createKernel() or %1$::getKernelClass() method.', static::class), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
@ -51,6 +51,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
|||||||
|
|
||||||
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
|
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
|
||||||
$def = $container->getDefinition($id);
|
$def = $container->getDefinition($id);
|
||||||
|
$def->setPublic(true);
|
||||||
$class = $def->getClass();
|
$class = $def->getClass();
|
||||||
$autowire = $def->isAutowired();
|
$autowire = $def->isAutowired();
|
||||||
|
|
||||||
|
@ -268,6 +268,21 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
|||||||
$this->assertEmpty(array_keys($locator));
|
$this->assertEmpty(array_keys($locator));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testControllersAreMadePublic()
|
||||||
|
{
|
||||||
|
$container = new ContainerBuilder();
|
||||||
|
$resolver = $container->register('argument_resolver.service')->addArgument(array());
|
||||||
|
|
||||||
|
$container->register('foo', ArgumentWithoutTypeController::class)
|
||||||
|
->setPublic(false)
|
||||||
|
->addTag('controller.service_arguments');
|
||||||
|
|
||||||
|
$pass = new RegisterControllerArgumentLocatorsPass();
|
||||||
|
$pass->process($container);
|
||||||
|
|
||||||
|
$this->assertTrue($container->getDefinition('foo')->isPublic());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provideBindings
|
* @dataProvider provideBindings
|
||||||
*/
|
*/
|
||||||
|
@ -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