Something difference betwen php-4.0.3 and php-4.2.3
| From: | andre dot lagadec at education dot gouv dot fr | Date: | Fri, 17 Jan 2003 18:22:12 +0000 |
| Subject: | Something difference betwen php-4.0.3 and php-4.2.3 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132026@lists.php.net to get a copy of this message | ||
Hello,
I try to move an Web application in Php-4.0.3 to php-4.2.3, and some
programs
don't work well on some pages. I make search in the code, and after
tests, I find that
the following code doesn't work in php-4.2.3, but works in php-4.0.3pl1
------------------------------------------------------------------------------------
<html>
<body>
<form>
<?
$i = 0;
while ($i<=3) {
$selected = "";
$selectTab[$i] = "<option value='".$i."'
".$selected."> bla bla
</option>\n";
$i++;
}
printf("<select name='filiere' multiple size='%d'
class='textNoir'>\n",
($i-1) );
$j = 0;
while ( $j <= $i ) {
printf($selectTab[$j]);
$j++;
}
printf("</select>");
?>
</body>
</html>
------------------------------------------------------------------------------------
It's because there is an error in the code : this instruction is wrong
while ( $j <= $i ),
there is an "out of range" in the array selectTab[] when $j=$i=4
the good instruction is while ( $j < $i )
Is there something changed in the gestion of the error "out of range" in
an array
betwen php-4.0.3pl1 and php-4.2.4 ?
Thanks for your help ?
AL