apache / apache/netbeans

Parsed variables in function names incorrectly flagged as syntax errors

Open
#7,795 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage PHP
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### 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:

![NetBeans bug](https://github.com/user-attachments/assets/74793d11-4b64-4e49-9250-a4704a573d71)

### Language / Project Type / NetBeans Component

PHP project

### How to reproduce

Enter this code in a PHP file:

```

Contributor guide

Open the contributing guide

Research direction

Use the PHP snippet in the issue as the reproduction, comparing the concatenation and interpolated-string forms of the dynamic function call in NetBeans. Confirm the behavior against PHP's output; done means the interpolated form is accepted without a syntax error while preserving the existing valid behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.