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.

Bug 157390

Summary: [hints] array access is not recognized as variable usage
Product: php Reporter: typhos <typhos>
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P4    
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 170541    

Description typhos 2009-01-24 14:05:38 UTC
In the current development build of netbeans with enabled warnings for unused variables I found a little bug:
If a variable is defined and used as object the usage isn't recognized and a warning is shown:

foreach ($list as $item)
{
    $item->field = "test";
}

In this case a warning is shown that $item is not used, but it is.

The same happens when you use a variable as index of an associative array:

foreach ($list as $key => $value)
{
    $list2[$key] = "test";
}

Here $key will be marked with the warning that it isn't used.
Comment 1 Tomasz Slota 2009-04-10 14:41:58 UTC
confirmed
Comment 2 Tomasz Slota 2009-04-10 14:44:18 UTC
*** Issue 155847 has been marked as a duplicate of this issue. ***
Comment 3 Tomasz Slota 2009-04-10 14:54:04 UTC
*** Issue 156415 has been marked as a duplicate of this issue. ***
Comment 4 rmatous 2009-09-22 12:25:40 UTC
experimental hints -> P4
Comment 5 Tomasz Slota 2010-02-10 08:45:55 UTC
reassigning to default owner
Comment 6 Filip Zamboj 2010-09-15 12:28:14 UTC
batch reassigning
Comment 7 cv47al 2011-04-29 07:12:07 UTC
A similar problem can be seen (in version 7.0) in a slightly different setup:

Example:


if (count($nameParts) >= 2) {
	$groupIndex = intval($nameParts[1]);
	$subjects[$groupIndex]['subjects'] = True;
}


Here the use of $groupIndex in the third line is not recognised and the hint is displayed.

I hope it's OK to add this note here. If it's a completely different issue, please let me know and I'll file a separate report for it.
Comment 8 Tomas Mysik 2011-06-08 14:57:06 UTC
Batch reassigning.
Comment 9 Ondrej Brejla 2011-09-13 08:06:56 UTC

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