Merge branch '4.4' into 5.2
* 4.4: [HttpKernel] do is_file check before include [PhpUnitBridge] fix reporting deprecations from DebugClassLoader [FrameworkBundle] skip deprecation in integration tests
This commit is contained in:
commit
bd9e2208a0
@ -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
|
||||
{
|
||||
}
|
@ -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