Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105083 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41490 invoked from network); 4 Apr 2019 19:48:09 -0000 Received: from unknown (HELO xdebug.org) (82.113.146.227) by pb1.pair.com with SMTP; 4 Apr 2019 19:48:09 -0000 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 05D5A10C7AE; Thu, 4 Apr 2019 17:43:48 +0100 (BST) Date: Thu, 4 Apr 2019 17:43:48 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: PHP Developers Mailing List cc: PHP Systems , Rasmus Lerdorf Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Bug #77845 [Com]: Error in the comparaison (fwd) From: derick@php.net (Derick Rethans) Hey, We have banned this "spam2" user from internals, but he's still being an ass on the bug system. Should I have a look at whether we can get him out of there as well? cheers, Derick -- https://derickrethans.nl | https://xdebug.org | https://dram.io Like Xdebug? Consider a donation: https://xdebug.org/donate.php, or become my Patron: https://www.patreon.com/derickr twitter: @derickr and @xdebug ---------- Forwarded message ---------- Date: Thu, 04 Apr 2019 14:37:14 +0000 From: spam2 at rhsoft dot net To: php-bugs@lists.php.net X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=1.2.4 Subject: Bug #77845 [Com]: Error in the comparaison Edit report at https://bugs.php.net/bug.php?id=77845&edit=1 ID: 77845 Comment by: spam2 at rhsoft dot net Reported by: baklouti dot med at gmail dot com Summary: Error in the comparaison Status: Not a bug Type: Bug Package: *Compile Issues Operating System: ubuntu 18.04 PHP Version: 7.2.16 Block user comment: N Private report: N New Comment: hell post the code you are actually using instead f**g decriptions ike " am not using the two cases in the same time" - switch works, full stop, echo what $id contains really at that moment Previous Comments: ------------------------------------------------------------------------ [2019-04-04 14:34:18] baklouti dot med at gmail dot com Yes, I try it with "case 0:" , and the same issue is happening. ------------------------------------------------------------------------ [2019-04-04 11:21:37] kalle@php.net Because `($id === 0)` is evaluated as an expression before, meaning that essentially the `case` statement now looks like `case 1:`. The correct way to do that which you are trying to would be to make your case statement simply look like `case 0:`. Please refer to the documentation int the future: https://www.php.net/manual/en/control-structures.switch.php ------------------------------------------------------------------------ [2019-04-04 11:10:25] baklouti dot med at gmail dot com Description: ------------ I am testing the value of $id to do some processing. I retrieve the variable $id from an array ($test) and converted to integer, for the case that $id = 0 when using "switch" it can't be detected and if I used the "if" it is working fine. I tried with the "==" and the "===" and also not working with "switch". I am not using the two cases in the same time, i tested the "if" and "switch" separately. $id = (integer)$test['id']; if ($id === 0 ) {return 1;} switch ($id) { case ($id === 0): return 2; .... Expected result: ---------------- The expected result is the bloc inside the case ($id ===0) is processed. Actual result: -------------- The actual result that it is passed for another case. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77845&edit=1