com php-src: Fixed bug #73329 (Float)"Nano" == NAN: Z end/zend_strtod_int.h tests/lang/bug73329.p hpt
| From: | Anatol Belski | Date: | Tue, 18 Oct 2016 17:11:18 +0000 |
| Subject: | com php-src: Fixed bug #73329 (Float)"Nano" == NAN: Z end/zend_strtod_int.h tests/lang/bug73329.p hpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95208@lists.php.net to get a copy of this message | ||
Commit: 9f2ab75b1096b881ee97eb2b436763aa14c19635
Author: Anatol Belski <ab@php.net> Tue, 18 Oct 2016 19:11:18 +0200
Parents: b4371a42921e4099a6110763b707abea7ffc0f03
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9f2ab75b1096b881ee97eb2b436763aa14c19635
Log:
Fixed bug #73329 (Float)"Nano" == NAN
The special cases (float)"inf", etc. were never intended and are
caused by the updated strtod lib. While it might be nice as an
easy way to produce Inf and NaN special values, it was never
documented and cause BC breaches.
Bugs:
https://bugs.php.net/73329
Changed paths:
M Zend/zend_strtod_int.h
A tests/lang/bug73329.phpt
Diff:
diff --git a/Zend/zend_strtod_int.h b/Zend/zend_strtod_int.h
index c1f66eb..5a6644b 100644
--- a/Zend/zend_strtod_int.h
+++ b/Zend/zend_strtod_int.h
@@ -68,6 +68,10 @@ typedef unsigned long int uint32_t;
#undef USE_LOCALE
#endif
+#ifndef NO_INFNAN_CHECK
+#define NO_INFNAN_CHECK
+#endif
+
#ifdef WORDS_BIGENDIAN
#define IEEE_BIG_ENDIAN 1
#else
diff --git a/tests/lang/bug73329.phpt b/tests/lang/bug73329.phpt
new file mode 100644
index 0000000..938f8ba
--- /dev/null
+++ b/tests/lang/bug73329.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #73329 (Float)"Nano" == NAN
+--FILE--
+<?php
+ var_dump(
+ (float)"nanite",
+ (float)"nan",
+ (float)"inf",
+ (float)"infusorian"
+ );
+?>
+==DONE==
+--EXPECT--
+float(0)
+float(0)
+float(0)
+float(0)
+==DONE==