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

From: Date: Sat, 22 Sep 2001 06:43:40 +0000
Subject: Bug #13387: Parser chokes on first case in switch statement if seperately script-delimited
Groups: php.dev 
Request: Send a blank email to php-dev+get-66303@lists.php.net to get a copy of this message
From:             macro@hotmail.com
Operating system: Mandrake Linux
PHP version:      4.0.5
PHP Bug Type:     *Compile Issues
Bug description:  Parser chokes on first case in switch statement if seperately script-delimited

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 bug report at: http://bugs.php.net/?id=13387&edit=1



Thread (2 messages)

« previous php.dev (#66303) next »