php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36939 unexpected T_ELSE, T_CASE
Submitted: 2006-04-01 08:10 UTC Modified: 2006-04-09 01:00 UTC
Votes:10
Avg. Score:4.4 ± 0.8
Reproduced:8 of 8 (100.0%)
Same Version:4 (50.0%)
Same OS:6 (75.0%)
From: jmichae3 at yahoo dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.1.2 OS: Windows XP Pro MP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-04-01 08:10 UTC] jmichae3 at yahoo dot com
Description:
------------
PHP gives "unexpected T_ELSE" and "unexpected T_CASE" errors on valid code.  checked the code over with brace checker and dreamweaver 8 and older versions of PHP for correctness.
maybe it has something to do with the structure of my if/else/switch statements and my weaving in and out of the PHP interpreter.  The rest of my 40+ files are fine.  just these 2 give me errors in the same place consistently.

Reproduce code:
---------------
http://mmediap3.home.comcast.net/z/phpprob.zip  includes include files header.php and dbinc.php

you may need to execute a short script with header.php in it and a line to set $_SESSION['tid']=1; for tareports.php to output XHTML.
execute script from command-line. (executing this script just caused PHP to hang and not die this time (?!?))

Expected result:
----------------
error messaged about $_SERVER[REMOTE_ADDR] not being defined. and maybe some messages about some session variables not being defined, ad a lot of XHTML.
if $_SESSION[tid] is not defined, no XHTML.
and if the tables aren't defined on your box (MySQL sql script included), probably mysql errors.

Actual result:
--------------
older versions of PHP output XHTML (or hang).
C:\prj>php tareports.php
PHP Parse error:  parse error, unexpected T_ELSE in tareports.php on line 211
causes PHP crash with stack trace outlined below.

When I comment this else block out, it complains about the next else. when I comment *that* out, it complains about the case statement that comes next. sounds to me like the parser's in an odd state, or some pointer or piece of memory got mangled.

C:\prj>php userreports.php
PHP Parse error:  syntax error, unexpected T_CASE in userreports.php on line 285
which causes an Access Violation.
Actually, all errors cause an Access Violation in this debug version.
Stack trace:
014d1c80()
tsrm_shutdown() line 180 + 4 bytes
main(int, char * *) line 1258

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-01 09:56 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

I'm sure to test the syntax we don't need any huge scripts in zip archive.
 [2006-04-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 16:01:31 2024 UTC