|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-13 23:52 UTC] helly@php.net
[2006-03-14 05:48 UTC] loikiolki at yahoo dot ca
[2006-03-14 15:17 UTC] mgf@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 07:00:01 2025 UTC |
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