php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13387 Parser chokes on first case in switch statement if seperately script-delimited
Submitted: 2001-09-22 08:43 UTC Modified: 2001-12-14 14:19 UTC
From: macro at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Mandrake Linux
Private report: No CVE-ID: None
 [2001-09-22 08:43 UTC] macro at hotmail dot 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!



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-14 14:19 UTC] yohgaki@php.net
I don't have problem with 4.2.0-dev, I guess it is fixed. 
Please reopen if problem remains.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 17:01:29 2024 UTC