summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-10-18 19:11:18 +0200
committerAnatol Belski <ab@php.net>2016-10-18 19:11:18 +0200
commit9f2ab75b1096b881ee97eb2b436763aa14c19635 (patch)
tree0a9471d34458c436991835e0906bfe990ad77765
parentb4371a42921e4099a6110763b707abea7ffc0f03 (diff)
downloadphp-git-9f2ab75b1096b881ee97eb2b436763aa14c19635.tar.gz
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.
-rw-r--r--Zend/zend_strtod_int.h4
-rw-r--r--tests/lang/bug73329.phpt18
2 files changed, 22 insertions, 0 deletions
diff --git a/Zend/zend_strtod_int.h b/Zend/zend_strtod_int.h
index c1f66eb19c..5a6644b878 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 0000000000..938f8bac24
--- /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==