-
-
Notifications
You must be signed in to change notification settings - Fork 138
Closed
Description
Considering the following test code:
(function(){
var foo = ["string1", "string2", "string3"];
})();
This is something the JS parser should ignore. Instead it somehow tries to interpret the array members as function arguments, which causes an exception in vendor/gettext/gettext/src/Utils/FunctionsScanner.php in line 29 “Notice: Undefined offset: 1”.
What helps is to check if the function definition is complete before adding it to the list. For example, one could replace lines 129-131 of Utils/JsFunctionsScanner.php with something like
if (!empty($bufferFunctions)) {
$function = array_shift($bufferFunctions);
if (isset($function[0]) && isset($function[1]) && isset($function[2]))
$functions[] = $function;
}
Though this doesn’t solve the underlying problem with the parser.
Metadata
Metadata
Assignees
Labels
No labels