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 192167 - Hint that variable is not initialized is shown for variable in a declaration of a function
Summary: Hint that variable is not initialized is shown for variable in a declaration ...
Status: RESOLVED DUPLICATE of bug 170541
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC Linux
: P4 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
: 192172 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-19 11:40 UTC by schkovich
Modified: 2011-09-13 08:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot ilustrating the problem (41.70 KB, image/png)
2010-11-19 12:05 UTC, schkovich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description schkovich 2010-11-19 11:40:31 UTC
Product Version = NetBeans IDE Dev (Build 201011190001)
Operating System = Linux version 2.6.35-22-generic running on amd64
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) 64-Bit Server VM 17.1-b03

Having experimental hints turned on (that's why P4) hint that variable might have not been initialized is shown for variable in a declaration of a function (see attached image).

Expected: No warning shown. 

To reproduce copy/paste to PHP file:
// {{{ constants

/**
 * Holds the path to the source files
 */
define('BASE_PATH',
        dirname(__FILE__) . \DIRECTORY_SEPARATOR . '..'
        . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR);
// }}}

/**
 * Define and register autoloader function
 */
if (false === \spl_autoload_register(function ($className) {
                    require \BASE_PATH . str_replace(
                                    "\\", \DIRECTORY_SEPARATOR, $className
                            ) . ".php";
                })) :
    throw new Exception("Unable to register autoload function.", 248);
endif;
Comment 1 schkovich 2010-11-19 12:05:00 UTC
Created attachment 103098 [details]
Screenshot ilustrating the problem
Comment 2 schkovich 2010-11-19 12:05:55 UTC
Variable in a declaration of a function (parameter) does not need to exist in the defining scope. Variable $className does not exist in the scope where anonymous function is defined but it must be defined in calling scope.
Comment 3 OndrejBrejla 2011-02-14 13:01:25 UTC
I can reproduce it.
Comment 4 schkovich 2011-03-01 15:14:51 UTC
*** Bug 192172 has been marked as a duplicate of this bug. ***
Comment 5 Tomas Mysik 2011-06-08 14:57:50 UTC
Batch reassigning.
Comment 6 Ondrej Brejla 2011-09-13 08:03:09 UTC

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