ID: 22847 Updated by: [EMAIL PROTECTED] Reported By: jparneodo at yahoo dot fr Status: Verified Bug Type: Scripting Engine problem Operating System: RH7.2 -PHP Version: 4.3.2-RC +PHP Version: 4.3.3RC2, 5.0.0b2-dev New Comment:
The problem can be replicated with a simpler script: <?php class A { var $b=1; function test() { global $g; $g =& $this->b; } } $n = new A(); $g = "BAR"; $n->test(); var_dump($g); ?> The problem itself appears to be ZE's inability to make a variable imported using global a reference. if $GLOBALS['var_name'] is used the script works correctly Previous Comments: ------------------------------------------------------------------------ [2003-04-23 05:51:44] jparneodo at yahoo dot fr Same result (bad) with PHP/4.3.2-RC http://snaps.php.net/win32/php4-win32-STABLE-latest.zip (no linux test can be done today) ------------------------------------------------------------------------ [2003-04-23 04:53:21] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-03-24 06:19:35] jparneodo at yahoo dot fr function cmp($a,$b){ global $g; var_dump($g); // NULL here if($g[$a]>$g[$b]){ return -1; }elseif($g[$a]<$g[$b]){ return 1; }else{ return 0; } } class A { var $aa=array('B'=>2,'A'=>1,'C'=>3); function sortme(){ global $g; $g=&$this->aa; uksort($g,'cmp'); } } $a=new A; $a->sortme(); // Don't work $g=&$a->aa; uksort($g,'cmp'); // Work ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22847&edit=1