php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6235 Enormous bug with switch and no case
Submitted: 2000-08-18 08:35 UTC Modified: 2000-08-18 08:37 UTC
From: remi at sinfomic dot fr Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: linux redhat 6.1
Private report: No CVE-ID: None
 [2000-08-18 08:35 UTC] remi at sinfomic dot fr
this doesnt work:
<?php
for ($i = 0; $i < 5; $i++) {
  print "<br>value of i = ".$i."\n";
  
  switch ($i) {
  default:
    print "<br>PHP is not buggy\n";
  }
}
?>

while this works:
<?php
for ($i = 0; $i < 5; $i++) {
  print "<br>value of i = ".$i."\n";
  
  switch ($i) {
  case 5:
    print "<br>I Will never go here\n";
    break;
  default:
    print "<br>PHP is not buggy\n";
  }
}
?>

this syntax works in C and PHP3, not in PHP4.0.1pl2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-18 08:37 UTC] waldschrott@php.net
fixed in CVS already
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Oct 12 15:00:01 2026 UTC