Skip to content

Commit fa7703b

Browse files
committed
[ErrorHandler] Do not patch return types that are not a valid PHP type
1 parent 38ab6de commit fa7703b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,11 @@ private function setReturnType(string $types, string $class, string $method, str
853853
return;
854854
}
855855

856+
if (!preg_match('/^(?:\\\\?[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)+$/', $n)) {
857+
// exclude any invalid PHP class name (e.g. `Cookie::SAMESITE_*`)
858+
continue;
859+
}
860+
856861
if (!isset($phpTypes[''])) {
857862
$phpTypes[] = $n;
858863
}

0 commit comments

Comments
 (0)