From:             owen dot beresford at murphx dot com
Operating system: linux
PHP version:      5.0.1
PHP Bug Type:     Variables related
Bug description:  apparent symbol table error with extract($blah, EXTR_REFS)

Description:
------------
PHP 5.0.1 (cli) (built: Aug 16 2004 23:07:06),
linux, rh7.3, kernel2.4, libc-2.2.5
The extract function seems incomplete/ broken.

I have a code base which uses arguments arrays, like perl.
Inorder to alter varaibles inside the parameter array in a convient
fashion, I extract the variables at the top of the methods.  

Some of the boundary cases don't perform correctly.   I have NOT
experienced this under other releases of php, so assume the problem is
induced by the new zend engine.

I am assuming that php 5.0.1 includes prevous fixes for errors reported
against php 4.3.8 and php 5.0.0 (there are closed cases with similar
problems). 

This is a small simple case, there are other failures, but this would
exceed the twenty line limit.  will post an URL with full senario
The described output ommited some of the english statements for brevity.
I have not tested this under other operating systems, but this is not a
platform dependant function (well it shouldn't be), and I don't have any
to hand.

in the interests of thoroughness:
Configure Command =>  './configure' '--prefix=/usr'
'--with-config-file-path=/etc' '--enable-cli' '--disable-cgi'
'--without-pear' '--enable-force-cgi-redirect' '--with-exec-dir=/usr/bin'
'--with-mysql' '--with-curl=/usr/local/lib' '--with-zlib'
'--enable-sockets' '--with-openssl' '--enable-pcntl' '--enable-libxml'
'--enable-shared'


Reproduce code:
---------------
function x($args) {
        $count  =extract($args, EXTR_REFS);
        echo("inside function x()\n$count items\n");
        $count+=10;
        echo("altered count to $count\n");
        var_dump(array($a, $b));
}

echo("before function x() (second is a null)\n");
$a=array('a'=>1, 'b'=>NULL);
var_dump($a);
x($a);

echo("before function x() (second is undefined variable)\n");
$d=array('a'=>1, 'b'=>NULL);
$e=array('a'=>1, 'b'=>$d['d']);
var_dump($e);
x($e);


Expected result:
----------------
array(2) {
  ["a"]=>
  int(1)
  ["b"]=>
  NULL
}

array(2) {
  ["a"]=>
  int(1)
  ["b"]=>
  NULL
}


Actual result:
--------------
array(2) {
  [0]=>
  int(1)
  [1]=>
  NULL
}

array(2) {
  [0]=>
  int(1)
  [1]=>
  int(12)
}


-- 
Edit bug report at http://bugs.php.net/?id=30074&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30074&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30074&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30074&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30074&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30074&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30074&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30074&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30074&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30074&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30074&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30074&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30074&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30074&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30074&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30074&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30074&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30074&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30074&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30074&r=mysqlcfg

Reply via email to