From: zeug at delirium dot ch Operating system: Linux 2.4.20-3-386 PHP version: 4.3.3 PHP Bug Type: Scripting Engine problem Bug description: Strange switch-case behaviour
Description: ------------ Hi there This is a very minor bug concerning the structure of a source code rather than its functionality. It's been dealt with in Bug #13387, yet the case was closed back then when it seems to have been fixed in 4.2.0-dev. It's back in 4.3.3. Here are some examples: Example 1, okay: <?php switch ($var): ?> <?php case 1: ?> <?php dothis() ?> <?php endswitch ?> Example 2, okay: <?php switch ($var) { ?> <?php case 1: ?> <?php dothis() ?> <?php } ?> Example 3, syntax error: <?php switch ($var): ?> <?php case 1: ?> <?php dothis() ?> <?php endswitch ?> The parser doesn't seem to like whitespace in HTML between switch and case. When mixing PHP and HTML code, the syntax in example 3 can improve readablility. Reproduce code: --------------- <?php $var = 1 ?> <?php switch ($var): ?> <?php case 1: ?> <?php print $var ?> <?php endswitch ?> Expected result: ---------------- 1 Actual result: -------------- Parse error: parse error, expecting `T_ENDSWITCH' or `T_CASE' or `T_DEFAULT' in .../test.php on line 4 -- Edit bug report at http://bugs.php.net/?id=25667&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25667&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25667&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25667&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25667&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25667&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25667&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25667&r=support Expected behavior: http://bugs.php.net/fix.php?id=25667&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25667&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25667&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25667&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25667&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25667&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25667&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25667&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25667&r=float