diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php index 3c32cb1c4a33a..c5dc408cf5211 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php @@ -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; + } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php index 917ea47235fd7..7ac72b1c2a2f5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php @@ -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; + } } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php index 8ac38133c06ee..a30383be9b23a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php @@ -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; + } } } }