#45109 [Csd->Bgs]: Inconsistent array loop
| From: | felipe@php.net | Date: | Tue, 27 May 2008 19:39:22 +0000 |
| Subject: | #45109 [Csd->Bgs]: Inconsistent array loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125316@lists.php.net to get a copy of this message | ||
ID: 45109
Updated by: felipe@php.net
Reported By: php-bug at undoso dot info
-Status: Closed
+Status: Bogus
Bug Type: Arrays related
Operating System: All
PHP Version: 5.2.6
Previous Comments:
------------------------------------------------------------------------
[2008-05-27 19:35:26] php-bug at undoso dot info
Forgot to close the bug !
------------------------------------------------------------------------
[2008-05-27 19:34:54] php-bug at undoso dot info
Yes, I was on 5.2.3. Looks like it is not doing that any more. Thanks a
lot and sorry for the useless bug ^^
------------------------------------------------------------------------
[2008-05-27 19:25:56] colder@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Can't reproduce
------------------------------------------------------------------------
[2008-05-27 18:54:10] php-bug at undoso dot info
Sorry, reproduce code is :
Reproduce code:
---------------
$arr = array();
$arr["loop"] = $arr;
print_r($arr);
and not the original one. I don't know how I did that change since I
just copied the code from my test file...
------------------------------------------------------------------------
[2008-05-27 18:47:15] php-bug at undoso dot info
Description:
------------
When assigning into a cell of an array the array itself, the result is
incoherent. Since the assignation does not use reference, the array
should be copied and not create a magical structure that looks like an
infinite loop.
The worst is that the array seems impossible to browse using PHP since
there is no way to find that we are on a portion that we already
visited, or not at my knowing.
Reproduce code:
---------------
$arr = array();
$arr["loop"] $ arr;
print_r($arr);
Expected result:
----------------
Array
(
[loop] => Array
(
)
)
Here is what the resulting print_r should looks like. Since no
reference is used, the array should be copied and only after that the
loop cell created.
Actual result:
--------------
The constructed array looks like that:
Array
(
[loop] => Array
*RECURSION*
)
wich is inconsistent.
By the way, f you find a way to browse this array in PHP and detect
that a recursion does exists, I want it because I just can't.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45109&edit=1