Bug #60082 [PATCH]: 100% CPU / when using references with ArrayObject(&$ref).
Edit report at https://bugs.php.net/bug.php?id=60082&edit=1
ID: 60082
Patch added 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:
The following patch has been added/updated:
Patch Name: bug60082.phpt
Revision: 1318942263
URL: https://bugs.php.net/patch-display.php?bug=60082&patch=bug60082.phpt&revision=1318942263
Previous Comments:
------------------------------------------------------------------------
[2011-10-18 12:46:20] laruence@php.net
The following patch has been added/updated:
Patch Name: bug60082.patch
Revision: 1318941980
URL: https://bugs.php.net/patch-display.php?bug=60082&patch=bug60082.patch&revision=1318941980
------------------------------------------------------------------------
[2011-10-18 09:38:44] laruence@php.net
$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
------------------------------------------------------------------------
[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)