Bug #74794 [Opn->Nab]: Strange bug where n/a == 0

From: Date: Wed, 21 Jun 2017 15:13:24 +0000
Subject: Bug #74794 [Opn->Nab]: Strange bug where n/a == 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209621@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74794&edit=1 ID: 74794 Updated by: cmb@php.net Reported by: azamorn at gmail dot com Summary: Strange bug where n/a == 0 -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Linux & Windows PHP Version: 7.2.0alpha1 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N 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 Especially, see <http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.types>. Previous Comments: ------------------------------------------------------------------------ [2017-06-21 14:50:25] azamorn at gmail dot com Description: ------------ I've tested the code on multiple versions of PHP, no matter where I test I get the same strange behaviour, actually really curious as to how this is even possible. It evaluates 'n/a' == 0 Even though they are obviously not the same thing. In the demo script the bug happens on the second option where I check whether the posted value is the same as the field value and if true I output 'selected' What you would expect to happen on load is that only the default value would be selected, however for some strange reason both 0 and n/a == n/a This code has been tested on at least 3 different machines, including on my own server here at https://www.differentiality.co.za, where I'm running the latest released version of PHP straight from apt-get. Please do contact me if I can be of any more assistance. Test script: --------------- I've posted a link to the page where the bug can be reproduced at PhpFiddle http://phpfiddle.org/main/code/4sr3-cq2w Expected result: ---------------- <option data-comparevalue="n/a" data-value="n/a" selected value="n/a">Please Select</option> <option data-comparevalue="0" data-value="n/a" value="0">Please Select</option> Actual result: -------------- <option data-comparevalue="n/a" data-value="n/a" selected value="n/a">Please Select</option> <option data-comparevalue="0" data-value="n/a" selected value="0">Please Select</option> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74794&edit=1

« previous php.bugs (#209621) next »