]> granicus.if.org Git - php/commitdiff
Fix comparisons of "inf"=="inf" and "-inf"=="-inf"
authorZeev Suraski <zeev@php.net>
Sat, 26 Feb 2000 04:07:03 +0000 (04:07 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 26 Feb 2000 04:07:03 +0000 (04:07 +0000)
@- Comparing the string "inf" with "inf" returned false - fixed (Zeev)

Zend/zend_operators.c

index a023a69ee68b28054424593d6b403e876b8c63f7..e87c4dc6e0a7fc0150b36172138574ae8a6b6caf 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <ctype.h>
+#include <math.h>
 
 #include "zend.h"
 #include "zend_operators.h"
@@ -1361,6 +1362,11 @@ ZEND_API inline int is_numeric_string(char *str, int length, long *lval, double
        errno=0;
        local_dval = strtod(str, &end_ptr);
        if (errno!=ERANGE && end_ptr == str+length) { /* floating point string */
+               if (local_dval==HUGE_VAL || local_dval==-HUGE_VAL) {
+                       /* "inf" */
+                       return 0;
+               }
+
                if (dval) {
                        *dval = local_dval;
                }