PHP 4.0 Bug #8114: case can be terminated by ; as well as : when writing switch statements.
| From: | juhl at eisenstein dot dk | Date: | Tue, 05 Dec 2000 10:52:03 +0000 |
| Subject: | PHP 4.0 Bug #8114: case can be terminated by ; as well as : when writing switch statements. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-40101@lists.php.net to get a copy of this message | ||
From: juhl@eisenstein.dk
Operating system: Linux
PHP version: 4.0.3pl1
PHP Bug Type: Scripting Engine problem
Bug description: case can be terminated by ; as well as : when writing switch statements.
When writing switch statements the documentation specifies that the different case statements should
be terminated by : (colon), but a ; (semicolon) is also accepted.
The code below writes 'Hello world' to the client. I believe it should instead have
produced a parse error on the
case 'bar';
line.
$foo = "bar";
switch ($foo) {
case 'bar';
echo 'Hello world\n';
break;
default:
echo 'Hit the default\n';
break;
}
Best regards,
Jesper Juhl
juhl@eisenstein.dk
--
Edit Bug report at: http://bugs.php.net/?id=8114&edit=1