#36729 [NEW]: Alternative syntax for switch() rejects whitespace

From: Date: Mon, 13 Mar 2006 22:44:18 +0000
Subject: #36729 [NEW]: Alternative syntax for switch() rejects whitespace
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94313@lists.php.net to get a copy of this message
From: loikiolki at yahoo dot ca Operating system: Windows XP PHP version: 5.1.2 PHP Bug Type: Feature/Change Request Bug description: Alternative syntax for switch() rejects whitespace Description: ------------ There is a bug regarding whitespace surrounding opening/closing php tags when using the alternative syntax for switch() statements. If you try to insert a tab or spaces before the opening php tag for the first case statement (<TAB><? case 'one': ?>), php dies with "PHP Parse error: syntax error, unexpected T_INLINE_HTML, expecting T_ENDSWITCH or T_CASE or T_DEFAULT". I realize that the only valid text between the 'switch' and first 'case' statement must be a 'case' or 'default' label, but whitespace should be an exception. Reproduce code: --------------- // Works if whitespace before "<? case 'one:': ?>" is removed $var = 'one'; <? switch($var): ?> <? case 'one': ?> <p>switch found one</p> <? break; ?> <? case 'two': ?> <p>switch found two</p> <break; ?> <? default: ?> <p>switch found something else</p> <? endswitch; ?> Expected result: ---------------- <p>switch found one</p> Actual result: -------------- PHP Parse error: syntax error, unexpected T_INLINE_HTML, expecting T_ENDSWITCH or T_CASE or T_DEFAULT in __FILE__ on line xxx -- Edit bug report at http://bugs.php.net/?id=36729&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36729&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36729&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36729&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36729&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36729&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36729&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36729&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36729&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36729&r=support Expected behavior: http://bugs.php.net/fix.php?id=36729&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36729&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36729&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36729&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36729&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36729&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36729&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36729&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36729&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36729&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36729&r=mysqlcfg

« previous php.bugs (#94313) next »