ID:               32786
 User updated by:  mcrusch at svm dot vetmed dot wisc dot edu
 Reported By:      mcrusch at svm dot vetmed dot wisc dot edu
 Status:           Bogus
 Bug Type:         Variables related
 Operating System: Windows XP SP2
 PHP Version:      4CVS-2005-04-20 (stable)
 New Comment:

Can you give me the ID of the bug report that gives the exact same
problem?  I have found many bug reports about extract(), but none that
I have found describe a problem closely related to this one.

Thanks.


Previous Comments:
------------------------------------------------------------------------

[2005-04-21 00:21:30] [EMAIL PROTECTED]

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.



------------------------------------------------------------------------

[2005-04-20 23:54:54] mcrusch at svm dot vetmed dot wisc dot edu

SuSE version is 9.1, sorry.

------------------------------------------------------------------------

[2005-04-20 23:52:08] mcrusch at svm dot vetmed dot wisc dot edu

Description:
------------
I called extract($array, EXTR_SKIP) in the global scope on an array and
one of the variables did not extract, even thought it was not set.

I traced the problem to a function call in which there was a global
statement involving the variable.  This seems to have created the
variable in the global scope, but isset($var) (in the global scope) and
isset($GLOBALS["var"]) both return false.  So, the variable is not set,
but it will not extract.  

The only way to detect that it is in the symbol table is to do a
print_r($GLOBALS), which allows you to visually see that it is there,
but there is no way to programmatically detect it (other than capturing
the output of print_r and parsing it--ugly!)

Problem also occurs on a SuSE 9.3 Linux box (Linux kernel v.
2.6.5-7.147-smp) running PHP 4.3.9

Reproduce code:
---------------
$arrayOfStuff = array("stuff" => "valueOfStuff");

echo isset($stuff).", ".isset($GLOBALS["stuff"]).", $stuff\n";

// Commenting out the globalStuff() call produces the 
// expected result

globalStuff();
extract($arrayOfStuff, EXTR_SKIP);

echo isset($stuff).", ".isset($GLOBALS["stuff"]).", $stuff\n";

function globalStuff() {
    global $stuff;
}

Expected result:
----------------
, , 
1, 1, valueOfStuff


Actual result:
--------------
, , 
, , 




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32786&edit=1

Reply via email to