Bug #13387 Updated: Parser chokes on first case in switch statement if seperately script-delimited
ID: 13387
Updated by: yohgaki
Reported By: macro@hotmail.com
Old Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Operating System: Mandrake Linux
PHP Version: 4.0.5
New Comment:
I don't have problem with 4.2.0-dev, I guess it is fixed.
Please reopen if problem remains.
Previous Comments:
------------------------------------------------------------------------
[2001-09-22 08:43:39] macro@hotmail.com
Description:
The parser chokes on the first case in switch statment if the switch and case statements are
separately script-delimited.
Error message:
Parse error: parse error, expecting T_CASE' or T_DEFAULT' or
`'}''
Example:
<? switch( $item["type"] ) { ?>
<? case "copy": ?> <- CHOKES ON THIS LINE
<?= $item["copy"] ?><br>
<? break; ?>
<? case "tidbit": ?>
<? $item["tidbit"]->WriteHTML(); ?>
<? break; ?>
...
<? } ?>
Removing the ?> <? between the switch and first case, like this, works:
<? switch( $item["type"] ) {
case "copy": ?>
<?= $item["copy"] ?><br>
<? break; ?>
<? case "tidbit": ?>
<? $item["tidbit"]->WriteHTML(); ?>
<? break; ?>
...
<? } ?>
Thanks, you guys rock!
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13387&edit=1
Thread (2 messages)