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.
Product Version = NetBeans IDE 7.2 (Build 201207171143) Operating System = Linux version 3.0.0-29-generic-pae running on i386 Java; VM; Vendor = 1.6.0_24 Runtime = OpenJDK Client VM 20.0-b12 [Product] and [Component] may be wrong above, pls fix as necessary! Sample code: <?php $a = 1; // case A: simple if using { }, error shows on if line if (empty($a)) { ; } // case B: if then else using { }, error shows on first closing } line if (empty($a)) { ; } else { ; } // case C: simple if without { }, error shows on if line if (empty($a)) ; // case D: if then else without { }, error shows on first ; line if (empty($a)) ; else ; ?> In each case A through D, remove the second closing parenthesis on the if statement and observe where the error is reported: A and C are the same, on the "if" line D places it at the first "then" line B places it at the end of the "then" { } block Case B especially has bitten me many times, having me check opening and closing bracket balance before realising .. It makes no difference if the "then" lines are just a ; as shown, or not.
Works properly for me in 7.2.1 and 7.3dev. No errors shown. Martine, can you confirm that? Thanks in advance.
Also works for me. I try it in 7.3 dev build, 7.2.1 and also 7.2. In each of them error message doesn't show up.
Huh? Did you read .... "In each case A through D, remove the second closing parenthesis on the if statement and observe where the error is reported" Here it is again, ~~parenthesis removed~~ <?php $a = 1; // case A: simple if using { }, error shows on if line if (empty($a) { ; } // case B: if then else using { }, error shows on first closing } line if (empty($a) { ; } else { ; } // case C: simple if without { }, error shows on if line if (empty($a) ; // case D: if then else without { }, error shows on first ; line if (empty($a) ; else ; ?> I didn't want cases cross polluting, but is the same. Also tested 7.3beta2
Ok, errors are shown... So I don't know, what is a problem...that the errors are not self-explanatory? So you think that error messages and places (underlined chars) should be improved? Definitely yes, but it's P4 defect, or P3 enhancement. Nothing is broken and everything works as it's intended for now (parser and error handler are written to work this way). Thanks for catching that.
The ~same~ error, in ~four~ similar code variants, gives ~three~ different error positions. So there is inconsistency, which surely is not intended. The result in Case B in the example is misleading, dare I say just plain wrong, often being far from the source of the problem. I don't know .. is there a situation where "if (empty($a) {" is legal? Thank you for your attention.
Hi, This doesn't occurs anymore on the 8.2 rc version (dev 201609210002) : - the if line is displayed in error if the { is present - the ; is displayed in error on the two last cases (netbeans search for a closing parenthis and found a ; ) Feel free to reopen the ticket if the problem isn't solved on your configuration. Regards