#20366 [Fbk->Opn]: Switch case inside loop causes no output from script
| From: | moptop69 at ntlworld dot com | Date: | Mon, 11 Nov 2002 20:20:14 +0000 |
| Subject: | #20366 [Fbk->Opn]: Switch case inside loop causes no output from script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24615@lists.php.net to get a copy of this message | ||
ID: 20366
User updated by: moptop69@ntlworld.com
Reported By: moptop69@ntlworld.com
-Status: Feedback
+Status: Open
Bug Type: Reproducible crash
Operating System: Win32 (2kSp3) and IIS5
PHP Version: 4.2.3
New Comment:
working fine now - under that new release
Previous Comments:
------------------------------------------------------------------------
[2002-11-11 13:49:53] derick@php.net
Works perfect here, can you try this snapshot?
http://snaps.php.net/win32/php4-win32-latest.zip
Derick
------------------------------------------------------------------------
[2002-11-11 13:49:06] moptop69@ntlworld.com
please note, case_test2.php even still has the last deliberate error i
introduced to see if it would fail on error
------------------------------------------------------------------------
[2002-11-11 13:47:39] moptop69@ntlworld.com
exactly as included previously:
case_test1.php:
---------------
<?
$i=1;
switch ($i) {
case 0:
print "i equals 0";
break;
case 1:
print "i equals 1";
break;
case 2:
print "i equals 2";
break;
default:
print "i is not equal to 0, 1 or 2";
}
?>
case_test2.php
--------------
<?
for ($i==0; $i<4; %i++)
{
switch ($i) {
case 0:
print "i equals 0";
break;
case 1:
print "i equals 1";
break;
case 2:
print "i equals 2";
break;
default:
print "i is not equal to 0, 1 or 2";
}
}
?>
runnning on win2k pro - sp3 - iis5 (all current security patches)
and just in case it makes any difference, I am NOT running any Zend
compiler/speed products currently
------------------------------------------------------------------------
[2002-11-11 13:12:55] derick@php.net
I couldnt not reproduce this, please provide a full script that we can
copy & paste to try.
Derick
------------------------------------------------------------------------
[2002-11-11 13:09:10] moptop69@ntlworld.com
Whilst converting what was turning out to be an increasingly lengthy
and untidy set of IF statements, i found this error. Similar in effect
to http://bugs.php.net/bug.php?id=1812
When a switch case structure is used inside a for loop, the execution
of the PHP script is NULL (or sometimes a page header is created)
example1:
$i=1;
switch ($i) {
case 0:
print "i equals 0";
break;
case 1:
print "i equals 1";
break;
case 2:
print "i equals 2";
break;
default:
print "i is not equal to 0, 1 or 2";
}
this script works correctly and outputs as you would expect. However,
if the switch statement is enclosed in a for loop like so:
for ($i=0; $i<4; $i++)
{
switch ($i) {
case 0:
print "i equals 0";
break;
case 1:
print "i equals 1";
break;
case 2:
print "i equals 2";
break;
default:
print "i is not equal to 0, 1 or 2";
}
}
the script does not seem to execute at all.
I deliberately introduced bad syntax into the program, leaving off
terminating ; and not using $ but the script does not even output
errors. It would appear the the script is not even getting to an error
reporting stage.
This has been tested on 4.2.1 and 4.2.3 versions od PHP
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20366&edit=1