php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1859 echo does not handle double scripted arrays
Submitted: 1999-07-23 21:36 UTC Modified: 1999-07-23 21:51 UTC
From: tim at inttek dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: Multiple
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tim at inttek dot com
New email:
PHP Version: OS:

 

 [1999-07-23 21:36 UTC] tim at inttek dot com

 --- Script 1 --- 
 echo("Start...<br>n"); 


 $x[0][0] = "A"; 
 $x[0][1] = "B"; 
 $x[1][0] = "C"; 
 $x[1][1] = "D"; 

 $size = sizeof($x); 

 echo("X array size = $size<br>n"); 

 for ($i = 0; $i < $size; $i++) { 

 $current_size = sizeof($x[$i]); 
 echo("x[$i] size = $current_size<br>n"); 

 for ($j = 0; $j < $current_size; $j++) { 
 echo("x[$i][$j] = $x[$i][$j]<br>n"); // FAILS 
 } 
 } 

 echo("Done..."); 

 ?> 

 ---- Script 2 ---- 
 <? 

 echo("Start...<br>n"); 
 $x[0][0] = "A"; 
 $x[0][1] = "B"; 
 $x[1][0] = "C"; 
 $x[1][1] = "D"; 

 $size = sizeof($x); 

 echo("X array size = $size<br>n"); 

 for ($i = 0; $i < $size; $i++) { 

 $current_size = sizeof($x[$i]); 
 echo("x[$i] size = $current_size<br>n"); 

 for ($j = 0; $j < $current_size; $j++) { 
 printf("x[$i][$j] = %s<br>n",$x[$i][$j]); // WORKS 
 } 
 } 
 echo("Done..."); 
 ?> 

---  Peter van Roosmalen has posted examples of this bug on the following systems ---

www.peerke.com (Apache 1.2.6 PHP 3.0RC3) 
www.roosmalen.com (Apache 1.3.4 PHP 3.07) 
home.cybercomm.nl (Apache 1.3.4 PHP 3.07) 

URLS: 
http://www.peerke.com/bug1.php3 
http://www.peerke.com/bug2.php3 
http://www.peerke.com/php.php3 
http://www.roosmalen.com/bug1.php3 
http://www.roosmalen.com/bug2.php3 
http://www.roosmalen.com/php.php3 
http://home.cybercomm.nl/~peerke/bug1.php3 
http://home.cybercomm.nl/~peerke/bug2.php3 
http://home.cybercomm.nl/~peerke/php.php3 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-23 21:51 UTC] jim at cvs dot php dot net
A limitation of PHP3's variables-in-quotes expansion.

Fixed in PHP4.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 01:01:34 2025 UTC