mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals - Updating psr/log (1.1.0 => 1.1.2) - Updating symfony/debug (v3.4.30 => v3.4.35) - Updating symfony/console (v3.4.30 => v3.4.35) - Updating symfony/dotenv (v3.4.30 => v3.4.35) - Updating symfony/routing (v3.4.30 => v3.4.35) - Updating symfony/finder (v3.4.30 => v3.4.35) - Updating symfony/filesystem (v3.4.30 => v3.4.35) - Installing symfony/polyfill-util (v1.12.0) - Installing symfony/polyfill-php56 (v1.12.0) - Updating symfony/http-foundation (v3.4.30 => v3.4.35) - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35) - Updating symfony/http-kernel (v3.4.30 => v3.4.35) - Updating symfony/config (v3.4.30 => v3.4.35) - Updating symfony/dependency-injection (v3.4.30 => v3.4.35) - Updating symfony/class-loader (v3.4.30 => v3.4.35) - Updating symfony/cache (v3.4.30 => v3.4.35) - Updating symfony/framework-bundle (v3.4.30 => v3.4.35) - Updating twig/twig (v1.42.2 => v1.42.4) - Updating symfony/twig-bridge (v3.4.30 => v3.4.35) - Updating symfony/twig-bundle (v3.4.30 => v3.4.35) - Updating symfony/yaml (v3.4.30 => v3.4.35) - Updating symfony/stopwatch (v3.4.30 => v3.4.35) - Updating symfony/var-dumper (v3.4.30 => v3.4.35) - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35) - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
@@ -76,10 +76,14 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
|
||||
|
||||
try {
|
||||
$exists = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
|
||||
} catch (\ReflectionException $e) {
|
||||
if (0 >= $timestamp) {
|
||||
unset(self::$existsCache[1][$this->resource]);
|
||||
throw $e;
|
||||
} catch (\Exception $e) {
|
||||
try {
|
||||
self::throwOnRequiredClass($this->resource, $e);
|
||||
} catch (\ReflectionException $e) {
|
||||
if (0 >= $timestamp) {
|
||||
unset(self::$existsCache[1][$this->resource]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
self::$autoloadedClass = $autoloadedClass;
|
||||
@@ -117,24 +121,57 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \ReflectionException When $class is not found and is required
|
||||
* Throws a reflection exception when the passed class does not exist but is required.
|
||||
*
|
||||
* A class is considered "not required" when it's loaded as part of a "class_exists" or similar check.
|
||||
*
|
||||
* This function can be used as an autoload function to throw a reflection
|
||||
* exception if the class was not found by previous autoload functions.
|
||||
*
|
||||
* A previous exception can be passed. In this case, the class is considered as being
|
||||
* required totally, so if it doesn't exist, a reflection exception is always thrown.
|
||||
* If it exists, the previous exception is rethrown.
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function throwOnRequiredClass($class)
|
||||
public static function throwOnRequiredClass($class, \Exception $previous = null)
|
||||
{
|
||||
if (self::$autoloadedClass === $class) {
|
||||
// If the passed class is the resource being checked, we shouldn't throw.
|
||||
if (null === $previous && self::$autoloadedClass === $class) {
|
||||
return;
|
||||
}
|
||||
$e = new \ReflectionException("Class $class not found");
|
||||
|
||||
if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) {
|
||||
if (null !== $previous) {
|
||||
throw $previous;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($previous instanceof \ReflectionException) {
|
||||
throw $previous;
|
||||
}
|
||||
|
||||
$e = new \ReflectionException(sprintf('Class "%s" not found while loading "%s".', $class, self::$autoloadedClass), 0, $previous);
|
||||
|
||||
if (null !== $previous) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$trace = $e->getTrace();
|
||||
$autoloadFrame = [
|
||||
'function' => 'spl_autoload_call',
|
||||
'args' => [$class],
|
||||
];
|
||||
$i = 1 + array_search($autoloadFrame, $trace, true);
|
||||
|
||||
if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) {
|
||||
if (false === $i = array_search($autoloadFrame, $trace, true)) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (isset($trace[++$i]['function']) && !isset($trace[$i]['class'])) {
|
||||
switch ($trace[$i]['function']) {
|
||||
case 'get_class_methods':
|
||||
case 'get_class_vars':
|
||||
|
||||
Reference in New Issue
Block a user