Skip to content

Commit b78b9a7

Browse files
author
Joseph Lenton
committed
fixed missing namespace support bug
Doing: \some_namespace\SomeClsss::doWork() broke the code. This was due to a lack of grabbing the namespace, in the function parsing. So it now grabs the namespace out.
1 parent 35ba8e3 commit b78b9a7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/php_error.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,22 @@ class ErrorHandler
222222
* {closure}()
223223
* blah::foo()
224224
* foo()
225+
*
226+
* It is:
227+
* a closure
228+
* or a method or function
229+
* followed by parenthesis '()'
230+
*
231+
* a function is 'namespace function'
232+
* a method is 'namespace class::function', or 'namespace class->function'
233+
* the whole namespace is optional
234+
* namespace is made up of an '\' and then repeating 'namespace\'
235+
* both the first slash, and the repeating 'namespace\', are optional
236+
*
237+
* 'END' matches it at the end of a string, the other one does not.
225238
*/
226-
const REGEX_METHOD_OR_FUNCTION_END = '/(\\{closure\\})|(\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(::[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)?)\\(\\)$/';
227-
const REGEX_METHOD_OR_FUNCTION = '/(\\{closure\\})|(\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(::[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)?)\\(\\)/' ;
239+
const REGEX_METHOD_OR_FUNCTION_END = '/(\\{closure\\})|(((\\\\)?(\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\\)*)?\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(::[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)?)\\(\\)$/';
240+
const REGEX_METHOD_OR_FUNCTION = '/(\\{closure\\})|(((\\\\)?(\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\\)*)?\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(::[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)?)\\(\\)/';
228241

229242
const REGEX_VARIABLE = '/\b[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/';
230243

0 commit comments

Comments
 (0)