From 21d7878690c18124fa788f2aa22e505a4fa6ceeb Mon Sep 17 00:00:00 2001 From: Andrea Faulds Date: Sun, 5 Feb 2017 01:30:20 +0000 Subject: Fix bug #73954 --- NEWS | 1 + Zend/configure.in | 2 +- Zend/tests/bug73954.phpt | 23 +++++++++++++++++++++++ configure.in | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug73954.phpt diff --git a/NEWS b/NEWS index 102c9eae00..adc80db1d3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS (Nikita) . Fixed bug #73998 (array_key_exists fails on arrays created by get_object_vars). (mhagstrand) + . Fixed bug #73954 (NAN check fails on Alpine Linux with musl). (Andrea) - GD: . Fixed bug #74031 (ReflectionFunction for imagepng is missing last two diff --git a/Zend/configure.in b/Zend/configure.in index 29551d924c..3c7915156c 100644 --- a/Zend/configure.in +++ b/Zend/configure.in @@ -75,7 +75,7 @@ int zend_sprintf(char *buffer, const char *format, ...); #elif defined(HAVE_FPCLASS) #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) #else -#define zend_isnan(a) 0 +#define zend_isnan(a) ((a) != (a)) #endif #endif diff --git a/Zend/tests/bug73954.phpt b/Zend/tests/bug73954.phpt new file mode 100644 index 0000000000..918f24b0f1 --- /dev/null +++ b/Zend/tests/bug73954.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #73954 (NAN check fails on Alpine Linux with musl) +--FILE-- + +--EXPECTF-- +float(NAN) +bool(true) + +Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type integer, float given, called in %s on line 9 and defined in %s:6 +Stack trace: +#0 %s(9): takes_int(NAN) +#1 {main} + thrown in %s on line 6 diff --git a/configure.in b/configure.in index a61a85d0fc..b5a3919e5f 100644 --- a/configure.in +++ b/configure.in @@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...); #elif defined(HAVE_FPCLASS) #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) #else -#define zend_isnan(a) 0 +#define zend_isnan(a) ((a) != (a)) #endif #endif -- cgit v1.2.1