#36729 [Opn->Bgs]: Alternative syntax for switch() rejects whitespace
| From: | helly@php.net | Date: | Mon, 13 Mar 2006 22:52:17 +0000 |
| Subject: | #36729 [Opn->Bgs]: Alternative syntax for switch() rejects whitespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94314@lists.php.net to get a copy of this message | ||
ID: 36729
Updated by: helly@php.net
Reported By: loikiolki at yahoo dot ca
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
-Operating System: Windows XP
+Operating System: *
-PHP Version: 5.1.2
+PHP Version: *
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2006-03-13 23:44:17] loikiolki at yahoo dot ca
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 this bug report at http://bugs.php.net/?id=36729&edit=1