Skip to content

Commit bb9adc4

Browse files
committedFeb 7, 2017
Merge branch 'PHP-7.0' into PHP-7.1
2 parents 189ea77 + 714d825 commit bb9adc4

File tree

5 files changed

+51
-22
lines changed

5 files changed

+51
-22
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.in

+7-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ int zend_sprintf(char *buffer, const char *format, ...);
6464

6565
/* To enable the is_nan, is_infinite and is_finite PHP functions */
6666
#ifdef NETWARE
67-
#define HAVE_ISNAN 1
68-
#define HAVE_ISINF 1
69-
#define HAVE_ISFINITE 1
67+
#define HAVE_DECL_ISNAN 1
68+
#define HAVE_DECL_ISINF 1
69+
#define HAVE_DECL_ISFINITE 1
7070
#endif
7171

7272
#ifndef zend_isnan
73-
#ifdef HAVE_ISNAN
73+
#ifdef HAVE_DECL_ISNAN
7474
#define zend_isnan(a) isnan(a)
7575
#elif defined(HAVE_FPCLASS)
7676
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -79,18 +79,18 @@ int zend_sprintf(char *buffer, const char *format, ...);
7979
#endif
8080
#endif
8181

82-
#ifdef HAVE_ISINF
82+
#ifdef HAVE_DECL_ISINF
8383
#define zend_isinf(a) isinf(a)
8484
#elif defined(INFINITY)
8585
/* Might not work, but is required by ISO C99 */
86-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
86+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
8787
#elif defined(HAVE_FPCLASS)
8888
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
8989
#else
9090
#define zend_isinf(a) 0
9191
#endif
9292

93-
#if defined(HAVE_ISFINITE) || defined(isfinite)
93+
#if defined(HAVE_DECL_ISFINITE)
9494
#define zend_finite(a) isfinite(a)
9595
#elif defined(HAVE_FINITE)
9696
#define zend_finite(a) finite(a)

‎configure.in

+7-7
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ int zend_sprintf(char *buffer, const char *format, ...);
6969
7070
/* To enable the is_nan, is_infinite and is_finite PHP functions */
7171
#ifdef NETWARE
72-
#define HAVE_ISNAN 1
73-
#define HAVE_ISINF 1
74-
#define HAVE_ISFINITE 1
72+
#define HAVE_DECL_ISNAN 1
73+
#define HAVE_DECL_ISINF 1
74+
#define HAVE_DECL_ISFINITE 1
7575
#endif
7676
7777
#ifndef zend_isnan
78-
#ifdef HAVE_ISNAN
78+
#ifdef HAVE_DECL_ISNAN
7979
#define zend_isnan(a) isnan(a)
8080
#elif defined(HAVE_FPCLASS)
8181
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -84,18 +84,18 @@ int zend_sprintf(char *buffer, const char *format, ...);
8484
#endif
8585
#endif
8686
87-
#ifdef HAVE_ISINF
87+
#ifdef HAVE_DECL_ISINF
8888
#define zend_isinf(a) isinf(a)
8989
#elif defined(INFINITY)
9090
/* Might not work, but is required by ISO C99 */
91-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
91+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
9292
#elif defined(HAVE_FPCLASS)
9393
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
9494
#else
9595
#define zend_isinf(a) 0
9696
#endif
9797
98-
#if defined(HAVE_ISFINITE) || defined(isfinite)
98+
#if defined(HAVE_DECL_ISFINITE)
9999
#define zend_finite(a) isfinite(a)
100100
#elif defined(HAVE_FINITE)
101101
#define zend_finite(a) finite(a)

‎ext/standard/config.m4

+8-7
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ 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)
292+
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
292293
AC_FUNC_FNMATCH
293294

294295
dnl
@@ -359,7 +360,7 @@ AC_TRY_RUN([
359360
#include <math.h>
360361
#include <stdlib.h>
361362
362-
#ifdef HAVE_ISNAN
363+
#ifdef HAVE_DECL_ISNAN
363364
#define zend_isnan(a) isnan(a)
364365
#elif defined(HAVE_FPCLASS)
365366
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -390,11 +391,11 @@ AC_TRY_RUN([
390391
#include <math.h>
391392
#include <stdlib.h>
392393
393-
#ifdef HAVE_ISINF
394+
#ifdef HAVE_DECL_ISINF
394395
#define zend_isinf(a) isinf(a)
395396
#elif defined(INFINITY)
396397
/* Might not work, but is required by ISO C99 */
397-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
398+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
398399
#elif defined(HAVE_FPCLASS)
399400
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
400401
#else
@@ -424,11 +425,11 @@ AC_TRY_RUN([
424425
#include <math.h>
425426
#include <stdlib.h>
426427
427-
#ifdef HAVE_ISINF
428+
#ifdef HAVE_DECL_ISINF
428429
#define zend_isinf(a) isinf(a)
429430
#elif defined(INFINITY)
430431
/* Might not work, but is required by ISO C99 */
431-
#define zend_isinf(a) (((a)==INFINITY)?1:0)
432+
#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
432433
#elif defined(HAVE_FPCLASS)
433434
#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
434435
#else
@@ -459,7 +460,7 @@ AC_TRY_RUN([
459460
#include <math.h>
460461
#include <stdlib.h>
461462
462-
#ifdef HAVE_ISNAN
463+
#ifdef HAVE_DECL_ISNAN
463464
#define zend_isnan(a) isnan(a)
464465
#elif defined(HAVE_FPCLASS)
465466
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))

‎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)
Please sign in to comment.