You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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.
The text was updated successfully, but these errors were encountered:
Yes, this seems to catch it. Running the parser on my relatively large JS code base works flawlessly and seems to catch all translations. Thanks again for the great support! :)
Considering the following test code:
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
Though this doesn’t solve the underlying problem with the parser.
The text was updated successfully, but these errors were encountered: