8000 [ErrorHandler] Fix strpos error when trying to call a method without … · symfony/debug@157bbec · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 157bbec

Browse files
Jérôme Deuchnordnicolas-grekas
Jérôme Deuchnord
authored andcommitted
[ErrorHandler] Fix strpos error when trying to call a method without a name
1 parent af4987a commit 157bbec

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

FatalErrorHandler/UndefinedMethodFatalErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function handleError(array $error, FatalErrorException $exception)
4040

4141
$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
4242

43-
if (!class_exists($className) || null === $methods = get_class_methods($className)) {
43+
if ('' === $methodName || !class_exists($className) || null === $methods = get_class_methods($className)) {
4444
// failed to get the class or its methods on which an unknown method was called (for example on an anonymous class)
4545
return new UndefinedMethodException($message, $exception);
4646
}

Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ public function provideUndefinedMethodData()
4848
],
4949
'Attempted to call an undefined method named "what" of class "SplObjectStorage".',
5050
],
51+
[
52+
[
53+
'type' => 1,
54+
'line' => 12,
55+
'file' => 'foo.php',
56+
'message' => 'Call to undefined method SplObjectStorage::()',
57+
],
58+
'Attempted to call an undefined method named "" of class "SplObjectStorage".',
59+
],
5160
[
5261
[
5362
'type' => 1,

0 commit comments

Comments
 (0)
0