#40730 [Opn->Bgs]: Array sequence corrupted when elements are added with double digit indexes

From: Date: Mon, 05 Mar 2007 14:59:55 +0000
Subject: #40730 [Opn->Bgs]: Array sequence corrupted when elements are added with double digit indexes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109927@lists.php.net to get a copy of this message
ID: 40730 Updated by: derick@php.net Reported By: slawo_c at o2 dot pl -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Mac OS X 10.4.8 PHP Version: 5.2.1 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2007-03-05 14:55:30] slawo_c at o2 dot pl Description: ------------ When I create an array using the following code the array is corrupted for some reason, as if the double digits were misinterpreted or misread at some point. From my experience it happens specifically on index 08 and 09 (which are set to 0) Even if the order is different. The consequence is that data with index 08 will be overwritten by 09 or 09 will be overwritten by 08 if 08 is set after 09. Example code: Reproduce code: --------------- $list = array(); $list[01]='a'; $list[02]='b'; $list[03]='c'; $list[04]='d'; $list[05]='da'; $list[06]='db'; $list[07]='dc'; $list[08]='e'; $list[09]='ea'; $list[10]='eb'; $list[11]='ec'; $list[12]='f'; echo '<pre>'; var_dump($list); echo '</pre>'; Expected result: ---------------- array(11) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" [4]=> string(1) "d" [5]=> string(2) "da" [6]=> string(2) "db" [7]=> string(2) "dc" [8]=> string(2) "e" [9]=> string(2) "ea" [10]=> string(2) "eb" [11]=> string(2) "ec" [12]=> string(1) "f" } Actual result: -------------- array(11) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" [4]=> string(1) "d" [5]=> string(2) "da" [6]=> string(2) "db" [7]=> string(2) "dc" [0]=> string(2) "ea" //<- Here 09 overwrote 08 which was also set to 0 by the parser/interpreter? [10]=> string(2) "eb" [11]=> string(2) "ec" [12]=> string(1) "f" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40730&edit=1

« previous php.bugs (#109927) next »