From: jmichae3 at yahoo dot com Operating system: Windows XP Pro MP PHP version: 5.1.2 PHP Bug Type: Scripting Engine problem Bug description: unexpected T_ELSE, T_CASE
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 -- Edit bug report at http://bugs.php.net/?id=36939&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36939&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36939&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36939&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36939&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36939&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36939&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36939&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36939&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36939&r=support Expected behavior: http://bugs.php.net/fix.php?id=36939&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36939&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36939&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36939&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36939&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36939&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36939&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36939&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36939&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36939&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36939&r=mysqlcfg