Bug #51841 [Opn->Bgs]: switch not working properly

From: Date: Mon, 17 May 2010 15:06:34 +0000
Subject: Bug #51841 [Opn->Bgs]: switch not working properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150515@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51841&edit=1 ID: 51841 Updated by: johannes@php.net Reported by: christian dot gnoth at arcor dot de Summary: switch not working properly -Status: Open +Status: Bogus Type: Bug Package: *General Issues Operating System: Linux x86_64 PHP Version: 5.2.13 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2010-05-17 16:54:48] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51841&edit=1

« previous php.bugs (#150515) next »