bug #38713 [DI] Fix Preloader exception when preloading a class with an unknown parent/interface (rgeraads)
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[DI] Fix Preloader exception when preloading a class with an unknown parent/interface
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #38693
| License | MIT
Fixes Preloader exception when preloading a class with an unknown parent/interface.
Commits
-------
b6ae4858b9
[DI] Fix Preloader exception when preloading a class with an unknown parent/interface
This commit is contained in:
commit
19804e1a02
@ -87,7 +87,7 @@ class Preloader
|
|||||||
|
|
||||||
self::preloadType($m->getReturnType(), $preloaded);
|
self::preloadType($m->getReturnType(), $preloaded);
|
||||||
}
|
}
|
||||||
} catch (\ReflectionException $e) {
|
} catch (\Throwable $e) {
|
||||||
// ignore missing classes
|
// ignore missing classes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,20 @@ class PreloaderTest extends TestCase
|
|||||||
self::assertTrue(class_exists('Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\C', false));
|
self::assertTrue(class_exists('Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\C', false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @requires PHP 7.4
|
||||||
|
*/
|
||||||
|
public function testPreloadSkipsNonExistingInterface()
|
||||||
|
{
|
||||||
|
$r = new \ReflectionMethod(Preloader::class, 'doPreload');
|
||||||
|
$r->setAccessible(true);
|
||||||
|
|
||||||
|
$preloaded = [];
|
||||||
|
|
||||||
|
$r->invokeArgs(null, ['Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\DummyWithInterface', &$preloaded]);
|
||||||
|
self::assertFalse(class_exists('Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\DummyWithInterface', false));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires PHP 8
|
* @requires PHP 8
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\Preload;
|
||||||
|
|
||||||
|
final class DummyWithInterface implements \NonExistentDummyInterface
|
||||||
|
{
|
||||||
|
}
|
Reference in New Issue
Block a user