Bug #74974 [Com]: NAN Comparison

From: Date: Sun, 23 Jul 2017 12:57:35 +0000
Subject: Bug #74974 [Com]: NAN Comparison
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210237@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74974&edit=1 ID: 74974 Comment by: mail at pmmaga dot net Reported by: webmaster at icecub dot nl Summary: NAN Comparison Status: Open Type: Bug Package: Math related PHP Version: 7.2Git-2017-07-22 (Git) Block user comment: N Private report: N New Comment: This has been fixed by commit https://github.com/php/php-src/commit/c562d44321ea69612fbe3f7460055e9ed4340baa Previous Comments: ------------------------------------------------------------------------ [2017-07-22 23:09:45] webmaster at icecub dot nl The expected output should be: FALSE FALSE According to the docs: Any loose or strict comparisons of this value against any other value, including itself, but except TRUE, will have a result of FALSE. ------------------------------------------------------------------------ [2017-07-22 22:51:48] webmaster at icecub dot nl Description: ------------ NAN Comparison is giving unexpected results since PHP version 5.4.0 up till the latest 7.2.0beta1. I know NAN comparison should be avoided. It's just a bug report. Test script: --------------- $nan = NAN; if(0 < NAN){ echo 'TRUE'; } else { echo 'FALSE'; } echo "\n"; if(0 < $nan){ echo 'TRUE'; } else { echo 'FALSE'; } Expected result: ---------------- Expected output in example script: TRUE TRUE Actual result: -------------- Output versions 7.0.0 - 7.2.0beta1: TRUE FALSE Output versions 5.4.0 - 5.6.30, hhvm-3.10.1 - 3.19.0: FALSE FALSE Output versions 4.3.6 - 5.3.29: TRUE TRUE ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74974&edit=1

« previous php.bugs (#210237) next »