From: mikael at SPAMMENOTchl dot chalmers dot se Operating system: Linux PHP version: 4.3.9 PHP Bug Type: Arrays related Bug description: Fix for #29493 seem to have caused other errors
Description: ------------ In regard to bug #29493 (would have added a comment to it if I could) -- This fix seems to have been backported to PHP 4.3.9, now we get other errors. In the example below $acopy is a reference to $arr['acopy'] and $a is also a reference to $arr['acopy'], when actually $a should have been separated from $arr['acopy'] when extract() makes the $acopy reference to $arr['acopy'] since the array is created with 'acopy' => $a $b, $arr['bref'] and $bref should and does however all point to the same value as they should since the array is created with 'bref' => &$b Reproduce code: ------------ Reproduce code: --------------- $a = 1; $b = 1; $arr = array('acopy' => $a, 'bref' => &$b); extract($arr, EXTR_REFS); $acopy++; $bref++; debug_zval_dump($a, $b, $arr, $acopy, $bref); Expected result: ---------------- (As seen on PHP < 4.3.9): $a: long(1) refcount(2) $b: long(2) refcount(1) $arr: array(2) refcount(2){ ["acopy"]=> &long(2) refcount(2) ["bref"]=> &long(2) refcount(3) } $acopy: long(2) refcount(1) $bref: long(2) refcount(1) Note: Shouldn't the refcount of $a be == 1 instead of 2. $a should be a separate zval while $arr['acopy'] and $acopy should be references to the same value as indicated by the refcount of 2 Actual result: -------------- $a is now == 2, when it should be == 1. Only $arr['acopy'] should be == 2 $a: long(2) refcount(1) $b: long(2) refcount(1) $arr: array(2) refcount(2){ ["acopy"]=> &long(2) refcount(3) ["bref"]=> &long(2) refcount(3) } $acopy: long(2) refcount(1) $bref: long(2) refcount(1) -- Edit bug report at http://bugs.php.net/?id=31213&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31213&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31213&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31213&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31213&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31213&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31213&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31213&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31213&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31213&r=support Expected behavior: http://bugs.php.net/fix.php?id=31213&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31213&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31213&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31213&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31213&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31213&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31213&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31213&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31213&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31213&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31213&r=mysqlcfg