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 209406 - $GLOBALS not so globals
Summary: $GLOBALS not so globals
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1.1
Hardware: All All
: P4 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-10 09:16 UTC by Landgraph
Modified: 2012-03-21 08:17 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 Landgraph 2012-03-10 09:16:12 UTC
<?php
class a {
  function f(){}
}

$GLOBALS['myA'] = new a();
$GLOBALS['somestring'] = 'test';

function test() {
    $asd = $GLOBALS['|'];
/*                   /\
 *                   ||
 * No code completion here...
 * ...and no code completion there
 *                   ||
 *                   \/
 */
    $GLOBALS['myA']->|
}
?>

Can somebody fix it?

I tried fix it by myself, but i can't understood phpcodecompletion class. And no documentation found about it. =(

P.S. Maybe somebody can help me with understanding phpcodecompletion class tree? =)
Comment 1 Ondrej Brejla 2012-03-20 12:24:31 UTC
First case...CC of indexes...it's an enhancement.

Second case...it should work, but P4 for me...using global variables is not a "nice coding way"...
Comment 2 Landgraph 2012-03-20 16:37:33 UTC
I agree, what CC of indexes it's an enhancement, but if we talk about "user defined" arrays. If we talk about predefined variable $GLOBALS - it's must be in CC model. $GLOBALS is created for storing indexed data, isn't? Maybe it is reason for create CC for $GLOBALS indexes? =) I would like to help, but I can't understand PHP CC model =(

Maybe using $GLOBALS is not "nice coding way", but we have it since... I think since php 1.0 =) But we don't have CC of it's indexes =(
Comment 3 Landgraph 2012-03-20 16:51:04 UTC
(In reply to comment #2)
> Maybe using $GLOBALS is not "nice coding way", but we have it since... I think
> since php 1.0 =) But we don't have CC of it's indexes =(

Superglobals we have since PHP 4.1.0 ;)
Comment 4 Ondrej Brejla 2012-03-21 08:17:39 UTC
I know that they are there for a long time, but it's hell ;)