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 213492 - Incorrect variable origin in code completion
Summary: Incorrect variable origin in code completion
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2
Hardware: All All
: P4 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2012-06-04 08:17 UTC by Vladimir Riha
Modified: 2012-06-04 08:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

sample project (2.33 KB, application/x-zip-compressed)
2012-06-04 08:17 UTC, Vladimir Riha

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-06-04 08:17:53 UTC
Created attachment 120282 [details]
sample project

When I declare some variable in fileA and include this file in 2 other files: fileB and fileC then code completion for the variable in fileB shows that the variable is declared in fileC

Check the sample project, 
- open file "index.php" 
- type "$" and invoke cc
- type "f" => cc list is reduced to 1 item but it shows that fooBar is declared in  "newEmptyPHP1.php" which is wrong

Notice the line with "$fooBar=1;" where cc for the variable shows correct origin.

Product Version: NetBeans IDE Dev (Build 201206040001)
Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 1 Ondrej Brejla 2012-06-04 08:33:57 UTC
I see right origin everywhere in index.php. But there is a problem, because you have it declared in newEmptyPHP1 too (and in index and in newEmptyPHP too). 

In every file there is some $fooBar assignment in a global context. Netbeans really don't know what will be the first declaration in runtime, so it takes some occurence during file scanning and handles it as "declaration".

I will leave it as P4 as a reminder, but it's a common won't fix.
Comment 2 Vladimir Riha 2012-06-04 08:44:05 UTC
OK, thanks