From:             forjest at gmail dot com
Operating system: WinXP, Linux
PHP version:      4.4.7
PHP Bug Type:     Arrays related
Bug description:  Internal pointer of source array resets during array copying

Description:
------------
Bug first appeared in 4.4.2. Version 4.4.1 works okay.
5.1.4, 5.2.1 has this bug too.
-----
Seems algorithm of array copying was changed at 4.4.2 and 5.1.2 versions.
-----
This behavior cause problems in unexpected situations such as error
handling functions, when array pointer reseted due copying from another
array which reference to it.


Reproduce code:
---------------
$Foo = array('val1', 'val2', 'val3');
end($Foo);
var_dump(key($Foo));
$MagicInternalPointerResetter = $Foo;
var_dump(key($Foo));
--
Code describing unexpected results of this behavior listed here:
http://www.pastebin.ru/10226


Expected result:
----------------
int(2) int(2)

Actual result:
--------------
int(2) int(0)

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

Reply via email to