PHP 4.0 Bug #7801 Updated: Problem with arrays
| From: | kir@php.net | Date: | Tue, 14 Nov 2000 10:00:11 +0000 |
| Subject: | PHP 4.0 Bug #7801 Updated: Problem with arrays | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38040@lists.php.net to get a copy of this message | ||
ID: 7801
Updated by: kir
Reported By: herve@herve-thouzard
Status: Closed
Bug Type: Arrays related
Assigned To:
Comments:
All numbers starting with 0 are assumed octal. So there
can't be 08 and 09.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-14 04:53:04] herve@herve-thouzard
It's not a crash but a strange behaviour.
Try this script and look the result (below) :
<?
$MyArray[00]="00";
$MyArray[01]="01";
$MyArray[02]="02";
$MyArray[03]="03";
$MyArray[04]="04";
$MyArray[05]="05";
$MyArray[06]="06";
$MyArray[07]="07";
$MyArray[08]="08";
$MyArray[09]="09";
$MyArray[10]="10";
for($i=0;$i<11;$i++)
{
printf("$i : %s<BR>n",$MyArray[$i]);
}
?>
I've made my array with 0s because I've filled my indices
with UltraEdit. If I remove the unwanted 0s, everything
is ok.
Here is the result (results are worst with previous versions
of PHP 4.03 pl1) :
0 : 09
1 : 01
2 : 02
3 : 03
4 : 04
5 : 05
6 : 06
7 : 07
<b>Warning</b>: Undefined offset: 8 in <b>bug.php</b> on line
<b>15</b>
8 :
<b>Warning</b>: Undefined offset: 9 in <b>bug.php</b> on line
<b>15</b>
9 :
10 : 10
My php.ini is the standard distributed file.
Bye,
Hervé
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7801