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 269093

Summary: NB incorrectly flags array index variable using curly braces as unused within scope
Product: php Reporter: jnm
Component: EditorAssignee: Tomas Mysik <tmysik>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 10 x64   
Issue Type: DEFECT Exception Reporter:

Description jnm 2016-11-23 15:25:16 UTC
I have a short function ... and it tags "$error" as unused, whilst it is used within the string ${error['index']} construct

function getErrorString($errorList) {
    $str = "";
    foreach ($errorList as $error) {
        $str .= "[errno ${error['errno']}]\n";
    }
    return $str;
}

It appears to be that indexed variables in conjunction wiht the ${...} construct provokes the problem.

Just using $error works as expected (no hint), as does ${error} and $error[1].  But ${error[1]} provokes it to be shown.