8000 minor #50102 [ErrorHandler] Avoid compile crash while trying to find … · camillebaronnet/symfony@1cfb601 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1cfb601

Browse files
committed
minor symfony#50102 [ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found (lyrixx)
This PR was submitted for the 5.4 branch but it was merged into the 6.4 branch instead. Discussion ---------- [ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | --- ## Before ![image](https://user-images.githubusercontent.com/408368/233658400-7e6fa6e9-3798-4cbb-a5ee-3a81e714d37d.png) ## After ![image](https://user-images.githubusercontent.com/408368/233658515-8f4c1b81-86cf-4d87-a25f-d63b025e37fb.png) Commits ------- fd1f4af [ErrorHandler] Avoid compile crash while trying to find candidate when a class is not found
2 parents 31bad80 + fd1f4af commit 1cfb601

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ private function convertFileToClass(string $path, string $file, string $prefix):
152152
}
153153
}
154154

155+
// Symfony may ship some polyfills, like "Normalizer". But if the Intl
156+
// extension is already installed, the next require_once will fail with
157+
// a compile error because the class is already defined. And this one
158+
// does not throw a Throwable. So it's better to skip it here.
159+
if (str_contains($file, 'Resources/stubs')) {
160+
return null;
161+
}
162+
155163
try {
156164
require_once $file;
157165
} catch (\Throwable) {

0 commit comments

Comments
 (0)
0