Req #76923 [NEW]: null comparing to string '0'

From: Date: Sun, 23 Sep 2018 16:09:22 +0000
Subject: Req #76923 [NEW]: null comparing to string '0'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217208@lists.php.net to get a copy of this message
From: gegpcoder at gmail dot com Operating system: all PHP version: 7.3.0RC1 Package: *General Issues Bug Type: Feature/Change Request Bug description:null comparing to string '0' Description: ------------ --- From manual page: http://www.php.net/language.types.null --- if '0' is false when converted to boolean and null is false as well why 0==null is true false==null is true '' ==null is true array()==null is true but '0' == null is false Test script: --------------- <?php echo null == 0; //true echo null == array(); //true echo null == ''; //true echo null == '0'; //false ?> Expected result: ---------------- 1111 Actual result: -------------- 111 -- Edit bug report at https://bugs.php.net/bug.php?id=76923&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76923&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76923&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76923&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76923&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76923&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76923&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76923&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76923&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76923&r=support Expected behavior: https://bugs.php.net/fix.php?id=76923&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76923&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76923&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76923&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76923&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76923&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76923&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76923&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76923&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76923&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76923&r=mysqlcfg

« previous php.bugs (#217208) next »