Skip to content

Commit 1b40313

Browse files
committed
Merge branch 'PHP-7.1'
2 parents ed4216c + bb9adc4 commit 1b40313

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

Zend/Zend.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ AC_FUNC_ALLOCA
100100
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
101101
AC_ZEND_BROKEN_SPRINTF
102102
103-
AC_CHECK_FUNCS(finite isfinite isinf isnan)
103+
AC_CHECK_DECLS([isfinite, isnan, isinf], [], [], [[#include <math.h>]])
104104
105105
ZEND_FP_EXCEPT
106106

Zend/configure.ac

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
6363
#include <math.h>
6464
6565
#ifndef zend_isnan
66-
#ifdef HAVE_ISNAN
66+
#ifdef HAVE_DECL_ISNAN
6767
#define zend_isnan(a) isnan(a)
6868
#elif defined(HAVE_FPCLASS)
6969
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -72,18 +72,18 @@ int zend_sprintf(char *buffer, const char *format, ...);
7272
#endif
7373
#endif
7474
75-
#ifdef HAVE_ISINF
75+
#ifdef HAVE_DECL_ISINF
7676
#define zend_isinf(a) isinf(a)
7777
#elif defined(INFINITY)
7878
/* Might not work, but is required by ISO C99 */
79-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
79+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
8080
#elif defined(HAVE_FPCLASS)
8181
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
8282
#else
8383
#define zend_isinf(a) 0
8484
#endif
8585
86-
#if defined(HAVE_ISFINITE) || defined(isfinite)
86+
#if defined(HAVE_DECL_ISFINITE)
8787
#define zend_finite(a) isfinite(a)
8888
#elif defined(HAVE_FINITE)
8989
#define zend_finite(a) finite(a)

configure.ac

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
6868
#include <math.h>
6969
7070
#ifndef zend_isnan
71-
#ifdef HAVE_ISNAN
71+
#ifdef HAVE_DECL_ISNAN
7272
#define zend_isnan(a) isnan(a)
7373
#elif defined(HAVE_FPCLASS)
7474
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -77,18 +77,18 @@ int zend_sprintf(char *buffer, const char *format, ...);
7777
#endif
7878
#endif
7979
80-
#ifdef HAVE_ISINF
80+
#ifdef HAVE_DECL_ISINF
8181
#define zend_isinf(a) isinf(a)
8282
#elif defined(INFINITY)
8383
/* Might not work, but is required by ISO C99 */
84-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
84+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
8585
#elif defined(HAVE_FPCLASS)
8686
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
8787
#else
8888
#define zend_isinf(a) 0
8989
#endif
9090
91-
#if defined(HAVE_ISFINITE) || defined(isfinite)
91+
#if defined(HAVE_DECL_ISFINITE)
9292
#define zend_finite(a) isfinite(a)
9393
#elif defined(HAVE_FINITE)
9494
#define zend_finite(a) finite(a)

ext/standard/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ dnl Check for available functions
288288
dnl
289289
dnl log2 could be used to improve the log function, however it requires C99. The check for log2 should be turned on,
290290
dnl as soon as we support C99.
291-
AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass isinf isnan mempcpy strpncpy)
291+
AC_CHECK_FUNCS(getcwd getwd asinh acosh atanh log1p hypot glob strfmon nice fpclass mempcpy strpncpy)
292292
AC_FUNC_FNMATCH
293293

294294
dnl

ext/standard/tests/math/bug74039.phpt

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
Bug #74039: is_infinite(-INF) returns false
3+
--FILE--
4+
<?php
5+
6+
var_dump(is_finite(INF));
7+
var_dump(is_infinite(INF));
8+
var_dump(is_nan(INF));
9+
10+
var_dump(is_finite(-INF));
11+
var_dump(is_infinite(-INF));
12+
var_dump(is_nan(-INF));
13+
14+
var_dump(is_finite(NAN));
15+
var_dump(is_infinite(NAN));
16+
var_dump(is_nan(NAN));
17+
18+
?>
19+
--EXPECT--
20+
bool(false)
21+
bool(true)
22+
bool(false)
23+
bool(false)
24+
bool(true)
25+
bool(false)
26+
bool(false)
27+
bool(false)
28+
bool(true)

0 commit comments

Comments
 (0)