php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75349 NAN comparison
Submitted: 2017-10-10 10:09 UTC Modified: 2017-10-10 12:07 UTC
From: fdivitto at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-10-10 10:09 UTC] fdivitto at gmail dot com
Description:
------------
Why this?

var_dump(NAN < 0);
--> produces "bool(true)"

...while...

$x=NAN;
var_dump($x < 0);
--> produces "bool(false)"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-10 10:15 UTC] danack@php.net
-Status: Open +Status: Feedback
 [2017-10-10 10:15 UTC] danack@php.net
I'm pretty sure this has been fixed since 7.1.9 and since 7.2.0beta2

https://3v4l.org/Fla0D


You said 'version irrelevant' - did you check up to date versions and are seeing something different, or did you just assume it affected all versions?
 [2017-10-10 10:20 UTC] spam2 at rhsoft dot net
it is fixed at least in 7.1.10 and hence "irrelevant" is always wrong to start with following http://www.catb.org/esr/faqs/smart-questions.html#beprecise

[harry@srv-rhsoft:~]$ php -v
PHP 7.1.10 (cli) (built: Sep 27 2017 15:50:29) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

[harry@srv-rhsoft:~]$ php -a
Interactive mode enabled
php > var_dump(NAN < 0);
bool(false)
php >
 [2017-10-10 11:49 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2017-10-10 11:49 UTC] cmb@php.net
This bug has been fixed with <http://git.php.net/?p=php-src.git;a=commit;h=c562d44>,
but probably should have a NEWS entry, pointing to this ticket.
 [2017-10-10 12:07 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC