Parsed variables in function names incorrectly flagged as syntax errors #7795
Labels
kind:bug
Bug report or fix
needs:triage
Requires attention from one of the committers
PHP
[ci] enable extra PHP tests (php/php.editor)
Apache NetBeans version
Apache NetBeans 23
What happened
In PHP, function names can be constructed as strings at runtime.
Such a process can involve joining two strings together, one of which is a variable.
These strings could be joined using the concatenation operator
('string_literal' . $stringVariable)
or by using double quotes so that PHP parses the variable"string_literal$stringVariable"
, and this can be done at the actual function call"string_literal$stringVariable"()
If the concatenation operator is used, NetBeans is perfectly happy, but if double quotes and variable parsing is used, NetBeans flags it as a syntax error:
Language / Project Type / NetBeans Component
PHP project
How to reproduce
Enter this code in a PHP file:
NetBeans should accept this code without issue, yet it flags it as a syntax error.
It can be verified that there is no such syntax error by running the code. PHP runs the code without errors or warnings, outputting
bool(true)
(because 7 is an integer).Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows 10 Pro, Version 22H2, OS build 19045.4046
JDK
Java Platform SE 22.0.2
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
No response
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: