Bug #60082 [Opn]: 100% CPU / when using references with ArrayObject(&$ref).
Edit report at https://bugs.php.net/bug.php?id=60082&edit=1
ID: 60082
Updated by: laruence@php.net
Reported by: tklingenberg at lastflood dot net
Summary: 100% CPU / when using references with
ArrayObject(&$ref).
Status: Open
Type: Bug
Package: SPL related
Operating System: GNU/Linux
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
$test = new ArrayObject(&$test) will make the intern->array a object;
thus, there will be a infinite loop between spl_array_get_properties and
spl_array_get_hash_table(call to HASH_OF which will call to
spl_array_get_properties). then PHP will segfault due to stack overflow...
I have tried to use SEPARATE_ARG_IF_REF to fix this segfault, but there is a
test faild (ext/spl/tests/array_004.phpt)
thanks
Previous Comments:
------------------------------------------------------------------------
[2011-10-17 22:30:44] tklingenberg at lastflood dot net
Description:
------------
100% CPU / when using references with ArrayObject(&$ref).
Passing a copy works.
Test script:
---------------
$test = array();
$test = new ArrayObject(&$test);
$test['a'] = $test['b'];
or:
$GLOBALS = new ArrayObject(&$GLOBALS);
$a = $GLOBALS['b'];
Expected result:
----------------
Set $test['a'] or $a to NULL with an undefined offset/index warning.
Actual result:
--------------
Endless Loop / CPU goes up 100% and stays.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60082&edit=1
Thread (9 messages)