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 - [hints] array access is not recognized as variable usage
Summary: [hints] array access is not recognized as variable usage
Status: RESOLVED DUPLICATE of bug 170541
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: All All
: P4 blocker with 2 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
: 155847 156415 (view as bug list)
Depends on:
Blocks: 170541
  Show dependency tree
 
Reported: 2009-01-24 14:05 UTC by typhos
Modified: 2011-09-13 08:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***