php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51841 switch not working properly
Submitted: 2010-05-17 16:54 UTC Modified: 2010-05-17 17:06 UTC
From: christian dot gnoth at arcor dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.13 OS: Linux x86_64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: christian dot gnoth at arcor dot de
New email:
PHP Version: OS:

 

 [2010-05-17 16:54 UTC] christian dot gnoth at arcor dot de
Description:
------------
$page_id is defined as global and empty

  switch ( $page_id )
  {
    case 0:
      echo '$page_id: ' . $page_id . '<br />';
      break;
    default:
      break;
  }

should go into the default tree, but uses the first one case 0.


Test script:
---------------
see above

Expected result:
----------------
see above


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-17 17:06 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-05-17 17:06 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Switch uses a comparison like ==. null == 0 evaluates to true, so the first block is executed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Aug 13 02:00:02 2025 UTC