Opened 9 years ago

Closed 7 years ago

Last modified 45 years ago

#477 closed Bugs (None)

DEFINE is not parset correctly

Reported by: emudojo Owned by: ed_mann
Priority: 5 Milestone:
Component: PHP Parser Version: None
Keywords: Cc:

Description

When you have some code like this

define('MAX_CONNECTION_STATUS_IGNORE',      1);
    define('MAX_CONNECTION_STATUS_PENDING',     2);
    define('MAX_CONNECTION_STATUS_ONHOLD',      3);
    define('MAX_CONNECTION_STATUS_APPROVED',    4);
    define('MAX_CONNECTION_STATUS_DISAPPROVED', 5);
    define('MAX_CONNECTION_STATUS_DUPLICATE',   6);

  
    $GLOBALS['_MAX']['STATUSES'] = array(
        MAX_CONNECTION_STATUS_IGNORE      =>
'strStatusIgnore',       // start value
        MAX_CONNECTION_STATUS_PENDING     =>
'strStatusPending',      // start value
        MAX_CONNECTION_STATUS_ONHOLD      =>
'strStatusOnHold',
        MAX_CONNECTION_STATUS_APPROVED    =>
'strStatusApproved',     // start value
        MAX_CONNECTION_STATUS_DISAPPROVED =>
'strStatusDisapproved',
        MAX_CONNECTION_STATUS_DUPLICATE   =>
'strStatusDuplicate',
    );

PHPeclipse underline the keys of the
$GLOBALS['_MAX']['STATUSES'] array, because for
Phpeclipse those GLOBAL variables haven't been
initialized. I have in my include path the folder
containing this file.

Change History (3)

comment:1 Changed 8 years ago by scorphus

Logged In: YES 
user_id=987242
Originator: NO

I don't confirm this bug. I unsuccessfully tried to reproduce it with this three different approaches:

Approach one:
[file="1477978_test_01.php"]
<?php
define('MAX_CONNECTION_STATUS_IGNORE', 1);
define('MAX_CONNECTION_STATUS_PENDING', 2);
define('MAX_CONNECTION_STATUS_ONHOLD', 3);
define('MAX_CONNECTION_STATUS_APPROVED', 4);
define('MAX_CONNECTION_STATUS_DISAPPROVED', 5);
define('MAX_CONNECTION_STATUS_DUPLICATE', 6);
$GLOBALS['_MAX']['STATUSES'] = array(
  MAX_CONNECTION_STATUS_IGNORE => 'strStatusIgnore', // start value
  MAX_CONNECTION_STATUS_PENDING => 'strStatusPending', // start value
  MAX_CONNECTION_STATUS_ONHOLD => 'strStatusOnHold',
  MAX_CONNECTION_STATUS_APPROVED => 'strStatusApproved', // start value
  MAX_CONNECTION_STATUS_DISAPPROVED => 'strStatusDisapproved',
  MAX_CONNECTION_STATUS_DUPLICATE => 'strStatusDuplicate',
);
?>
[/file]

Approach two:
[file="1477978_test_02-a.php"]
<?php
define('MAX_CONNECTION_STATUS_IGNORE', 1);
define('MAX_CONNECTION_STATUS_PENDING', 2);
define('MAX_CONNECTION_STATUS_ONHOLD', 3);
define('MAX_CONNECTION_STATUS_APPROVED', 4);
define('MAX_CONNECTION_STATUS_DISAPPROVED', 5);
define('MAX_CONNECTION_STATUS_DUPLICATE', 6);
?>
[/file]
[file="1477978_test_02-b.php"]
<?php
require_once '1477978_test_02-a.php';
$GLOBALS['_MAX']['STATUSES'] = array(
  MAX_CONNECTION_STATUS_IGNORE => 'strStatusIgnore', // start value
  MAX_CONNECTION_STATUS_PENDING => 'strStatusPending', // start value
  MAX_CONNECTION_STATUS_ONHOLD => 'strStatusOnHold',
  MAX_CONNECTION_STATUS_APPROVED => 'strStatusApproved', // start value
  MAX_CONNECTION_STATUS_DISAPPROVED => 'strStatusDisapproved',
  MAX_CONNECTION_STATUS_DUPLICATE => 'strStatusDuplicate',
);
?>
[/file]

Approach three:
[file="1477978_test_03.php"]
<?php
define(MAX_CONNECTION_STATUS_IGNORE, 1);
define(MAX_CONNECTION_STATUS_PENDING, 2);
define(MAX_CONNECTION_STATUS_ONHOLD, 3);
define(MAX_CONNECTION_STATUS_APPROVED, 4);
define(MAX_CONNECTION_STATUS_DISAPPROVED, 5);
define(MAX_CONNECTION_STATUS_DUPLICATE, 6);
$GLOBALS['_MAX']['STATUSES'] = array(
  MAX_CONNECTION_STATUS_IGNORE => 'strStatusIgnore', // start value
  MAX_CONNECTION_STATUS_PENDING => 'strStatusPending', // start value
  MAX_CONNECTION_STATUS_ONHOLD => 'strStatusOnHold',
  MAX_CONNECTION_STATUS_APPROVED => 'strStatusApproved', // start value
  MAX_CONNECTION_STATUS_DISAPPROVED => 'strStatusDisapproved',
  MAX_CONNECTION_STATUS_DUPLICATE => 'strStatusDuplicate',
);
?>
[/file]

For all these tests, all files were parsed correctly and no error nor warning arose.

I'm using Eclipse 3.2.1 and phpeclipse-1.1.9-cvs-20060920

Regards,
Pablo Aguiar.

comment:2 Changed 7 years ago by emann

Logged In: YES 
user_id=430467
Originator: NO

Hertzel,

Can you please give me a version on what you are using PHPEclipse and Eclipse. I was not able to reproduce on PHPEclipse 1.1.8

Thanks.

comment:3 Changed 7 years ago by scorphus

  • Status changed from assigned to closed
Logged In: YES 
user_id=987242
Originator: NO

This is issue is solved as another developer could not reproduce it even on 1.1.8 So it works on 1.1.8, 1.1.9-CVS20060920 and current CVS. I'm closing this bug.
Note: See TracTickets for help on using tickets.