Bug #13387 Updated: Parser chokes on first case in switch statement if seperately script-delimited

From: Date: Fri, 14 Dec 2001 19:19:20 +0000
Subject: Bug #13387 Updated: Parser chokes on first case in switch statement if seperately script-delimited
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-73807@lists.php.net to get a copy of this message
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)

« previous php.dev (#73807) next »