Bug #74974 [Opn->Csd]: NAN Comparison

From: Date: Sun, 23 Jul 2017 13:00:32 +0000
Subject: Bug #74974 [Opn->Csd]: NAN Comparison
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210238@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 Updated by: kalle@php.net Reported by: webmaster at icecub dot nl Summary: NAN Comparison -Status: Open +Status: Closed Type: Bug Package: Math related PHP Version: 7.2Git-2017-07-22 (Git) -Assigned To: +Assigned To: pollita Block user comment: N Private report: N New Comment: Fixed by Sara Previous Comments: ------------------------------------------------------------------------ [2017-07-23 12:57:33] mail at pmmaga dot net This has been fixed by commit https://github.com/php/php-src/commit/c562d44321ea69612fbe3f7460055e9ed4340baa ------------------------------------------------------------------------ [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 (#210238) next »