Bug #12554: switch() bug
| From: | lee at mediawaveonline dot com | Date: | Fri, 03 Aug 2001 14:15:28 +0000 |
| Subject: | Bug #12554: switch() bug | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-61960@lists.php.net to get a copy of this message | ||
From: lee@mediawaveonline.com
Operating system: linux
PHP version: 4.0.6
PHP Bug Type: Variables related
Bug description: switch() bug
<?
switch($search)
{
case 'date':
echo 'date';
break;
case 'people':
echo 'people';
break;
case 'keyword':
echo 'keyword';
break;
default:
echo 'default';
break;
}
?>
Warning: Undefined variable: search in
/home/httpd/vhosts/mediawaveonline/test2.php on line 4
Warning: Undefined variable: search in
/home/httpd/vhosts/mediawaveonline/test2.php on line 7
Warning: Undefined variable: search in
/home/httpd/vhosts/mediawaveonline/test2.php on line 10
if you ask me, I should get a warning on line 2 where the switch is, not
on
4, 7, 10 where the case statements are.
php 4.0.5 cgi does not do this.
Chris Lee
lee@mediawaveonline.com
--
Edit bug report at: http://bugs.php.net/?id=12554&edit=1