php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4340 Switch fails with empty variables
Submitted: 2000-05-06 07:25 UTC Modified: 2000-06-10 16:41 UTC
From: barmeier at barmeier dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Release Candidate 1 OS: NT4 SP5 IIs4
Private report: No CVE-ID: None
 [2000-05-06 07:25 UTC] barmeier at barmeier dot com
Tho following script produces an undesired result if
$k is never used before.

switch ($k){
   case '0':
      echo "OOPS nothing is equal to the charachter 0 ??";
      break;
   default:
      echo "Everything is fine !";
      break;
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-09 14:08 UTC] stas at cvs dot php dot net
that's because case uses "equal" operation instead of "identical"
operation. Is this expected behaviour?
 [2000-06-10 16:41 UTC] andi at cvs dot php dot net
Fixed in latest CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 17:01:27 2024 UTC