PHP 4.0 Bug #7801: Problem with arrays
| From: | herve at herve-thouzard dot chek dot com | Date: | Tue, 14 Nov 2000 09:53:04 +0000 |
| Subject: | PHP 4.0 Bug #7801: Problem with arrays | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38037@lists.php.net to get a copy of this message | ||
From: herve@herve-thouzard
Operating system: Windows 95 and 2000
PHP version: 4.0.3pl1
PHP Bug Type: Arrays related
Bug description: Problem with arrays
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é
--
Edit Bug report at: http://bugs.php.net/?id=7801&edit=1