Bug #73329 [Ver]: (Float)"Nano" == NAN [Should return me 0]

From: Date: Mon, 17 Oct 2016 13:48:55 +0000
Subject: Bug #73329 [Ver]: (Float)"Nano" == NAN [Should return me 0]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204865@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73329&edit=1 ID: 73329 Updated by: cmb@php.net Reported by: nikcomestotalk at gmail dot com Summary: (Float)"Nano" == NAN [Should return me 0] Status: Verified Type: Bug Package: Scripting Engine problem Operating System: Any PHP Version: 7.0.12 Block user comment: N Private report: N New Comment: I'm not sure if that qualifies as bug; simply ignoring unrecognized trailing characters is normal behavior of float conversion, see <https://3v4l.org/F18FJ> and even <https://3v4l.org/dYHtG>. (I don't find this behavior particularly useful, but we have it.) Previous Comments: ------------------------------------------------------------------------ [2016-10-17 12:47:11] nikcomestotalk at gmail dot com That's why i raised the bug (Float)"NANO" (Float)"INF" (Float)"INFORMATION" (Float) NAN [Only this should give NAN, since it's not a string] HHVM also faces the same problem https://github.com/facebook/hhvm/issues/6986 Fixed in https://github.com/facebook/hhvm/commit/e6abf022c3b32944ba0c861ca073fbfed9fc9be8 ------------------------------------------------------------------------ [2016-10-17 11:27:49] requinix@php.net https://3v4l.org/FPsXI https://github.com/php/php-src/blob/6053987bc27e8dede37f437193a5cad448f99bce/Zend/zend_strtod.c#L2720 It checks for "inf/infinity/nan" but not for a \0 afterwards. ------------------------------------------------------------------------ [2016-10-17 10:59:22] nikcomestotalk at gmail dot com Description: ------------ (Float)"Nano" == NAN [Should return me 0] (Float)"Information" == NAN [Should return me 0] Expected result: ---------------- Should return me 0 Actual result: -------------- NAN or INF ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73329&edit=1

« previous php.bugs (#204865) next »