ID: 31213 Comment by: ian_real at dominios dot net Reported By: mikael at SPAMMENOTchl dot chalmers dot se Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.3.9 Assigned To: moriyoshi New Comment:
This seemed to be fixed on 4.3.10, but is now failing on STABLE-200503201730 ---- EXPECTED OUTPUT int(1) int(1) int(1) int(2) int(2) int(2) array(2) { ["_a"]=> &int(2) ["_b"]=> &int(2) } int(1) int(1) int(1) int(2) int(2) int(2) array(2) { ["_a"]=> &int(2) ["_b"]=> &int(2) } ---- ACTUAL OUTPUT int(1) int(1) int(1) int(2) int(2) int(2) array(2) { ["_a"]=> &int(2) ["_b"]=> &int(2) } int(1) int(1) int(2) int(2) int(2) int(2) array(2) { ["_a"]=> &int(2) ["_b"]=> &int(2) } ---- FAILED Previous Comments: ------------------------------------------------------------------------ [2005-01-19 22:11:51] [EMAIL PROTECTED] See also bug #31217 and bug #30074 ------------------------------------------------------------------------ [2004-12-21 00:11:04] mikael at SPAMMENOTchl dot chalmers dot se 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 this bug report at http://bugs.php.net/?id=31213&edit=1