php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2368 switch command bug
Submitted: 1999-09-23 17:43 UTC Modified: 1999-09-23 19:54 UTC
From: cd_record at mycar dot co dot il Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: win95
Private report: No CVE-ID: None
 [1999-09-23 17:43 UTC] cd_record at mycar dot co dot il
when using switch command on an empty or null variable,
when getting to case 08, it commits it...
for example :

<?
$aa="";

switch($aa)
{
caes 01:
     echo "a";
     break;
caes 08:
     echo "b";
     break;
}


this will display 'b'







Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-23 19:54 UTC] riffraff at cvs dot php dot net
08 is an invalid number (8 has no value in octal), so it
resolves as 0. in php, 0 equals to "" and thus the case
works right.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 11:00:01 2026 UTC