Bug #74794 [NEW]: Strange bug where n/a == 0

From: Date: Wed, 21 Jun 2017 14:50:30 +0000
Subject: Bug #74794 [NEW]: Strange bug where n/a == 0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209620@lists.php.net to get a copy of this message
From: azamorn at gmail dot com Operating system: Linux & Windows PHP version: 7.2.0alpha1 Package: Scripting Engine problem Bug Type: Bug Bug description:Strange bug where n/a == 0 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 bug report at https://bugs.php.net/bug.php?id=74794&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74794&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74794&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74794&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74794&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74794&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74794&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74794&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74794&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74794&r=support Expected behavior: https://bugs.php.net/fix.php?id=74794&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74794&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74794&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74794&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74794&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74794&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74794&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74794&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74794&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74794&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74794&r=mysqlcfg

« previous php.bugs (#209620) next »