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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: macro at hotmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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 May 05 08:01:30 2024 UTC