Skip to content

Commit de2ff4c

Browse files
symfonyamlnicolas-grekas
authored andcommitted
[ErrorHandler] Fix RecursiveDirectoryIterator exception with wrong composer autoload
1 parent 0e58bb2 commit de2ff4c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ErrorEnhancer/ClassNotFoundErrorEnhancer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
class ClassNotFoundErrorEnhancer implements ErrorEnhancerInterface
2323
{
24-
/**
25-
* {@inheritdoc}
26-
*/
2724
public function enhance(\Throwable $error): ?\Throwable
2825
{
2926
// Some specific versions of PHP produce a fatal error when extending a not found class.
@@ -110,7 +107,8 @@ private function getClassCandidates(string $class): array
110107

111108
private function findClassInPath(string $path, string $class, string $prefix): array
112109
{
113-
if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
110+
$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path);
111+
if (!$path || !is_dir($path)) {
114112
return [];
115113
}
116114

0 commit comments

Comments
 (0)