Bug #17721: Braindead error for malformed switch statement

From: Date: Wed, 12 Jun 2002 05:37:00 +0000
Subject: Bug #17721: Braindead error for malformed switch statement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10210@lists.php.net to get a copy of this message
From: kims@contrail.com.au Operating system: Debian GNU/Linux PHP version: 4.0CVS-2002-06-11 PHP Bug Type: Scripting Engine problem Bug description: Braindead error for malformed switch statement When one forgets to the closing curly bracket ("}") in a switch statement, php gives an error of: Parse error: parse error, unexpected $ in /home/kims/switch.php on line n (where n is the numer of lines in the script). This error is completely unhelpful. The error should, at a minimum, report that the problem is an "unterminated switch" or a "missing }". Even better, would be "unterminated switch (starting on line n)", or "missing } after last case" or something. Here's a script that causes this error: <? switch ('foo') { default: echo "Hello World!\n"; /* uncomment to make this work */ // } ?> -- Edit bug report at http://bugs.php.net/?id=17721&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17721&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17721&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17721&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17721&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17721&r=support Expected behavior: http://bugs.php.net/fix.php?id=17721&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17721&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17721&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17721&r=globals

« previous php.bugs (#10210) next »