This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Useless PHP syntax checking | ||
---|---|---|---|
Product: | php | Reporter: | JohnnyWalker2001 |
Component: | Editor | Assignee: | Ondrej Brejla <obrejla> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | OndrejBrejla |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://stackoverflow.com/q/5636592/199700 | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
JohnnyWalker2001
2011-04-14 17:25:25 UTC
Maybe it's somehow connected with http://netbeans.org/bugzilla/show_bug.cgi?id=168350 ? (In reply to comment #1) > Maybe it's somehow connected with > http://netbeans.org/bugzilla/show_bug.cgi?id=168350 ? 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: <?php class TEST { private function testfnc($xml) { private $test = ""; // <---- Error } } ?> 2 - If there are more lines after the error the marked line is the wrong one: <?php 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. The error handling is the first version from 6.5. Needs to be improved. *** This bug has been marked as a duplicate of bug 211165 *** |