#29044 [Opn->Fbk]: compact function doesn't take account of infinitly recursive arrays
| From: | helly@php.net | Date: | Wed, 07 Jul 2004 09:05:43 +0000 |
| Subject: | #29044 [Opn->Fbk]: compact function doesn't take account of infinitly recursive arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61841@lists.php.net to get a copy of this message | ||
ID: 29044
Updated by: helly@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
-Operating System: WinXP
+Operating System: *
PHP Version: 5.0.0RC3
New Comment:
Nothing much we could do about it.
Detecting a recursion at the same level, as in your example, is easy
but detecting multi-level recursion is very hard. Also it would slow
down the function very much and require lots of memory when it is used
with multi level arrays.
Maybe we can disallow array references or something like that. Patch is
here:
http://marcus-boerger.de/php/ext/bug29044.diff.txt
please try.
Previous Comments:
------------------------------------------------------------------------
[2004-07-07 10:39:37] tomas_matousek at hotmail dot com
Description:
------------
The compact() function crashes (terminates PHP process) if an array
with infinite recursion is passed to it.
Reproduce code:
---------------
$a = array(&$a);
compact($a);
Expected result:
----------------
none
Actual result:
--------------
crash
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29044&edit=1