Skip to content

Commit

Permalink
[FrameworkBundle][CacheWarmer] Ignore exeptions thrown during reflect…
Browse files Browse the repository at this point in the history
…ion classes autoload
  • Loading branch information
fancyweb committed Jul 12, 2019
1 parent ee5e5de commit 2f420b6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Expand Up @@ -75,6 +75,17 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
* environment but is always added to the annotations.map file by some Symfony default behaviors,
* and you always end up with a not found Annotation.
*/
} catch (\Exception $e) {
// Ignore exceptions that are thrown during this class autoload.
if (false === array_search([
'function' => 'spl_autoload_call',
'args' => [$class],
], $e->getTrace(), true) ||
class_exists($class, false) ||
interface_exists($class, false) ||
trait_exists($class, false)) {
throw $e;
}
}
}

Expand Down
Expand Up @@ -60,6 +60,17 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
// ignore failing reflection
} catch (AnnotationException $e) {
// ignore failing annotations
} catch (\Exception $e) {
// Ignore exceptions that are thrown during this mapped class autoload.
if (false === array_search([
'function' => 'spl_autoload_call',
'args' => [$mappedClass],
], $e->getTrace(), true) ||
class_exists($mappedClass, false) ||
interface_exists($mappedClass, false) ||
trait_exists($mappedClass, false)) {
throw $e;
}
}
}
}
Expand Down
Expand Up @@ -65,6 +65,17 @@ protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
// ignore failing reflection
} catch (AnnotationException $e) {
// ignore failing annotations
} catch (\Exception $e) {
// Ignore exceptions that are thrown during this mapped class autoload.
if (false === array_search([
'function' => 'spl_autoload_call',
'args' => [$mappedClass],
], $e->getTrace(), true) ||
class_exists($mappedClass, false) ||
interface_exists($mappedClass, false) ||
trait_exists($mappedClass, false)) {
throw $e;
}
}
}
}
Expand Down

0 comments on commit 2f420b6

Please sign in to comment.