|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-03-05 21:43 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-03-05 21:43 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 19:00:01 2026 UTC |
Description: ------------ When using a switch statement inside a foreach loop array elements that have a value of 0 are compared in case statements incorrectly. Test script: --------------- $a = [0,0,0,0,0]; foreach ($a as $i) { switch ($i) { case $i > 0: echo 'true'; } } Expected result: ---------------- We should expect no output since 0 is not greater than 0 and therefore doesn't satisfy the case. This has been tested on both 7.2 and 7.1. Actual result: -------------- truetruetruetruetrue