bug #33532 [HttpKernel] fix compat with legacy DebugClassLoader (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] fix compat with legacy DebugClassLoader

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

73198c6d51 [HttpKernel] fix compat with legacy DebugClassLoader
This commit is contained in:
Nicolas Grekas 2019-09-10 18:52:40 +02:00
commit 8ca975ddf4
2 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\DependencyInjection;
use Composer\Autoload\ClassLoader;
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\ErrorHandler\DebugClassLoader;
@ -90,7 +91,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
continue;
}
if ($function[0] instanceof DebugClassLoader) {
if ($function[0] instanceof DebugClassLoader || $function[0] instanceof LegacyDebugClassLoader) {
$function = $function[0]->getClassLoader();
}

View File

@ -16,6 +16,7 @@ use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -544,7 +545,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
// Remove frames added by DebugClassLoader.
for ($i = \count($backtrace) - 2; 0 < $i; --$i) {
if (DebugClassLoader::class === ($backtrace[$i]['class'] ?? null)) {
if (\in_array($backtrace[$i]['class'] ?? null, [DebugClassLoader::class, LegacyDebugClassLoader::class], true)) {
$backtrace = [$backtrace[$i + 1]];
break;
}