Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 197756 - Useless PHP syntax checking
Useless PHP syntax checking
Status: RESOLVED DUPLICATE of bug 211165
Product: php
Classification: Unclassified
Component: Editor
All All
: P3 with 2 votes (vote)
: 7.2
Assigned To: Ondrej Brejla
Depends on:
  Show dependency treegraph
Reported: 2011-04-14 17:25 UTC by JohnnyWalker2001
Modified: 2012-04-13 14:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description JohnnyWalker2001 2011-04-14 17:25:25 UTC
I've tested the same file with several different IDEs and NetBeans is the only one (so far) that is unable to locate the source of the issue and point the user to the correct line of code.

I didn't think it was a bug at first, but given how every other PHP IDE (Eclipse, etc.) handles the problem correctly, I've begun to suspect that it is.

Please look at the supplied link for specifics on the problem.

Comment 1 OndrejBrejla 2011-04-15 08:34:53 UTC
Maybe it's somehow connected with ?
Comment 2 paolosca 2011-04-16 15:02:25 UTC
(In reply to comment #1)
> Maybe it's somehow connected with
> ?

Yes, I think it may be related. Fixing this would make a very good enhancement.

A few tests I made:

1 - In this case the line marked is the correct one one:

class TEST {
	private function testfnc($xml) {
		private $test = "";    // <---- Error

2 - If there are more lines after the error the marked line is the wrong

class TEST {
	private function testfnc($xml) {
		private $test = "";

	private function testfnc2($xml) {
		$test = "";
	}    // <---- Error

My guess is that the syntax checker doesn't stop at the first error, it attempts to keep parsing the whole code and only the last line that returns error is marked.

This makes it very hard to locate the error line in long code.

Moreover, the error returned by the syntax checker is rather generic:

Syntax error:
Unexpected: if, identifier, variable, echo, do, while, [...]

While parsing the file with php -l the error is reported is much more precise:

PHP Parse error:  syntax error, unexpected T_PRIVATE in test.php on line 12

Several other IDEs rely on the php executable to check the code while I assume Netbeans relies on an internal syntax checker.

Perhaps netbeans should use both methods and the internal syntax checker could be used in case php is not installed in the system.
Comment 3 Petr Pisl 2011-09-29 10:59:14 UTC
The error handling is the first version from 6.5. Needs to be improved.
Comment 4 Ondrej Brejla 2012-04-13 14:18:24 UTC

*** This bug has been marked as a duplicate of bug 211165 ***

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo