From:             [EMAIL PROTECTED]
Operating system: Win32 (2kSp3) and IIS5
PHP version:      4.2.3
PHP Bug Type:     Reproducible crash
Bug description:  Switch case inside loop causes no output from script

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 bug report at http://bugs.php.net/?id=20366&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20366&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20366&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20366&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20366&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20366&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20366&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20366&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20366&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20366&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20366&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20366&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20366&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20366&r=isapi

Reply via email to