Bug #17721 Updated: Braindead error for malformed switch statement

From: Date: Wed, 12 Jun 2002 05:59:06 +0000
Subject: Bug #17721 Updated: Braindead error for malformed switch statement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10211@lists.php.net to get a copy of this message
ID: 17721 Updated by: mfischer@php.net Reported By: kims@contrail.com.au -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Debian GNU/Linux PHP Version: 4.0CVS-2002-06-11 New Comment: The engine can't and won't catch every user stupidity out there. Previous Comments: ------------------------------------------------------------------------ [2002-06-12 01:36:59] kims@contrail.com.au 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 this bug report at http://bugs.php.net/?id=17721&edit=1

« previous php.bugs (#10211) next »