Merge branch '5.2' into 5.x
* 5.2: [HttpKernel] do is_file check before include [PhpUnitBridge] fix reporting deprecations from DebugClassLoader [FrameworkBundle] skip deprecation in integration tests enable HTTP method overrides as early as possible with the HTTP cache
This commit is contained in:
commit
485c896b4b
@ -83,6 +83,11 @@ class Deprecation
|
||||
$this->triggeringFile = isset($trace[1 + $j]['args'][1]) ? realpath($trace[1 + $j]['args'][1]) : (new \ReflectionClass($class))->getFileName();
|
||||
$this->getOriginalFilesStack();
|
||||
array_splice($this->originalFilesStack, 0, $j, [$this->triggeringFile]);
|
||||
|
||||
if (preg_match('/(?|"([^"]++)" that is deprecated|should implement method "([^:]++))/', $message, $m) || preg_match('/^(?:The|Method) "([^":]++)/', $message, $m)) {
|
||||
$this->triggeringFile = (new \ReflectionClass($m[1]))->getFileName();
|
||||
array_unshift($this->originalFilesStack, $this->triggeringFile);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Test that a deprecation from the DebugClassLoader triggered by an app class extending a vendor one is considered direct.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$k = 'SYMFONY_DEPRECATIONS_HELPER';
|
||||
putenv($k.'='.$_SERVER[$k] = $_ENV[$k] = 'max[total]=0');
|
||||
putenv('ANSICON');
|
||||
putenv('ConEmuANSI');
|
||||
putenv('TERM');
|
||||
|
||||
$vendor = __DIR__;
|
||||
while (!file_exists($vendor.'/vendor')) {
|
||||
$vendor = dirname($vendor);
|
||||
}
|
||||
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
require_once __DIR__.'/../../bootstrap.php';
|
||||
eval(<<<'EOPHP'
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
class Test
|
||||
{
|
||||
public static function getGroups()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
EOPHP
|
||||
);
|
||||
require __DIR__.'/fake_vendor/autoload.php';
|
||||
|
||||
\Symfony\Component\ErrorHandler\DebugClassLoader::enable();
|
||||
new \App\Services\ExtendsDeprecatedFromVendor();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Remaining direct deprecation notices (1)
|
||||
|
||||
1x: The "App\Services\ExtendsDeprecatedFromVendor" class extends "fcy\lib\DeprecatedClass" that is deprecated.
|
||||
1x in DebugClassLoader::loadClass from Symfony\Component\ErrorHandler
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use fcy\lib\DeprecatedClass;
|
||||
|
||||
final class ExtendsDeprecatedFromVendor extends DeprecatedClass
|
||||
{
|
||||
}
|
@ -18,6 +18,7 @@ use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Store;
|
||||
use Symfony\Component\HttpKernel\HttpCache\StoreInterface;
|
||||
use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
/**
|
||||
@ -62,6 +63,15 @@ class HttpCache extends BaseHttpCache
|
||||
parent::__construct($kernel, $this->createStore(), $this->createSurrogate(), array_merge($this->options, $this->getOptions()));
|
||||
}
|
||||
|
||||
public function handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)
|
||||
{
|
||||
if ($this->kernel->getContainer()->getParameter('kernel.http_method_override')) {
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
}
|
||||
|
||||
return parent::handle($request, $type, $catch);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -14,5 +14,4 @@ use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle
|
||||
|
||||
return [
|
||||
new FrameworkBundle(),
|
||||
new TestBundle(),
|
||||
];
|
||||
|
@ -466,7 +466,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
if (!flock($lock, $wouldBlock ? \LOCK_SH : \LOCK_EX)) {
|
||||
fclose($lock);
|
||||
$lock = null;
|
||||
} elseif (!\is_object($this->container = include $cachePath)) {
|
||||
} elseif (!is_file($cachePath) || !\is_object($this->container = include $cachePath)) {
|
||||
$this->container = null;
|
||||
} elseif (!$oldContainer || \get_class($this->container) !== $oldContainer->name) {
|
||||
flock($lock, \LOCK_UN);
|
||||
|
Reference in New Issue
Block a user