From: memoimyself at yahoo dot com dot br
Operating system: Windows 2000 SP 4
PHP version: 4.3.4
PHP Bug Type: Scripting Engine problem
Bug description: SWITCH fails when DEFAULT statement included
Description:
------------
The "switch" statement fails when a "default" case is included, as in the
example below. It makes no difference if there's a "break" at the end of
the default case.
I'm not leaving out any parentheses, braces or semi-colons. In fact, all
you need to do in order to get the switch statement below to work is
comment out the last two lines before the closing brace.
Reproduce code:
---------------
$test = 'a';
switch ($test)
{
case 'a':
print 'a';
break;
case 'b':
print 'b';
break;
default:
print 'neither';
}
Expected result:
----------------
String 'a' should be printed on screen.
Actual result:
--------------
Parse error: parse error, unexpected T_DEFAULT in D:\htdocs\Test\test.php
on line 12
--
Edit bug report at http://bugs.php.net/?id=26671&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26671&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26671&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26671&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26671&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26671&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26671&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26671&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26671&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26671&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26671&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26671&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26671&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26671&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26671&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26671&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26671&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26671&r=float