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.
Hello Netbeans warns me with a little yellow alert sign on the left side that the following code is considered suspicious. When I put the mouse over the alert sign it says "Variable does not seem to be used in this scope". I like this check as it helps spotting typos in variable names but this time it is certainly on the wrong track. It underlins the $i in the foreach statement although that variable gets used as a object reference one line below: class T { public $attr = 42; public function f() { $a = array(new T(), new T()); foreach ($a as $i) { echo $i->attr; } } } The bug does not occur in every foreach nor if I move the foreach out of the class.
experimental hint *** This bug has been marked as a duplicate of bug 170541 ***