Skip to content

Commit

Permalink
better patch for class_exists handling in HeroAutoload class
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Sep 17, 2018
1 parent df6e167 commit 7235d22
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/HeroAutoload.php
Expand Up @@ -14,13 +14,24 @@ public static function handle(string $class)
return;
}

$debugBacktrace = debug_backtrace();
if ($debugBacktrace[1]['function'] === 'spl_autoload_call' &&
$debugBacktrace = \debug_backtrace();
if (
isset($debugBacktrace[1]['function'], $debugBacktrace[2]['function']) &&
$debugBacktrace[1]['function'] === 'spl_autoload_call' &&
$debugBacktrace[2]['function'] === 'class_exists'
) {
return;
}

if (\in_array(
$class,
[
'ErrorHeroModuleLogger',
]
)) {
return;
}

throw new RuntimeException(sprintf(
'class %s not found',
$class
Expand Down

0 comments on commit 7235d22

Please sign in to comment.