Bug #80490 [NEW]: Switch choose a wrong block, if int(0) is a value

From: Date: Mon, 07 Dec 2020 12:08:36 +0000
Subject: Bug #80490 [NEW]: Switch choose a wrong block, if int(0) is a value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230891@lists.php.net to get a copy of this message
From: miso at fykos dot cz Operating system: ubuntu 18.04 PHP version: 7.4.13 Package: Scripting Engine problem Bug Type: Bug Bug description:Switch choose a wrong block, if int(0) is a value Description: ------------ When argument of switch is a int(0), switch choose a wrong statement. Test script: --------------- <?php $key = 0; switch ($key) { case 'a': echo 'break'; break; default: echo 'default'; break; } Expected result: ---------------- 'default' Actual result: -------------- 'break' -- Edit bug report at https://bugs.php.net/bug.php?id=80490&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80490&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80490&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80490&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80490&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80490&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80490&r=support Expected behavior: https://bugs.php.net/fix.php?id=80490&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80490&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80490&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80490&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80490&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80490&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80490&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80490&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80490&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80490&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80490&r=mysqlcfg

« previous php.bugs (#230891) next »