]> granicus.if.org Git - php/commitdiff
MFH: Fix handling of INF/NAN in unserialize().
authorIlia Alshanetsky <iliaa@php.net>
Sun, 30 Jan 2005 16:39:09 +0000 (16:39 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 30 Jan 2005 16:39:09 +0000 (16:39 +0000)
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re

index e0d1fe8ddff0341a04ba6e5e5637f31d5cdf10aa..6ac7e04c07669d66caf3cc0f44377727bb29478f 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.3 on Wed Jan 26 11:12:49 2005 */
+/* Generated by re2c 0.9.3 on Sun Jan 30 11:27:32 2005 */
 #line 1 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 /*
   +----------------------------------------------------------------------+
@@ -420,7 +420,7 @@ yy3:        yyaccept = 0;
        if(yych == ':') goto yy87;
        goto yy4;
 yy4:
-#line 576 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 574 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 { return 0; }
 #line 102 "<stdout>"
 yy5:   yyaccept = 0;
@@ -461,7 +461,7 @@ yy13:       yyaccept = 0;
 yy14:  ++YYCURSOR;
        goto yy15;
 yy15:
-#line 570 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 568 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
        /* this is the case where we have less data than planned */
        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data");
@@ -490,7 +490,7 @@ yy21:       yych = *++YYCURSOR;
 yy22:  ++YYCURSOR;
        goto yy23;
 yy23:
-#line 477 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 475 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
        size_t len, len2, maxlen;
        int elements;
@@ -612,7 +612,7 @@ yy28:       yych = *++YYCURSOR;
 yy29:  ++YYCURSOR;
        goto yy30;
 yy30:
-#line 469 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 467 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
 
        INIT_PZVAL(*rval);
@@ -644,7 +644,7 @@ yy35:       yych = *++YYCURSOR;
 yy36:  ++YYCURSOR;
        goto yy37;
 yy37:
-#line 451 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 449 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
        int elements = parse_iv(start + 2);
 
@@ -686,7 +686,7 @@ yy42:       yych = *++YYCURSOR;
 yy43:  ++YYCURSOR;
        goto yy44;
 yy44:
-#line 423 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 421 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
        size_t len, maxlen;
        char *str;
@@ -803,7 +803,7 @@ yy54:       if(yych <= ';'){
 yy55:  ++YYCURSOR;
        goto yy56;
 yy56:
-#line 416 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 414 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 {
        *p = YYCURSOR;
        INIT_PZVAL(*rval);
@@ -874,9 +874,7 @@ yy67:
 {
        *p = YYCURSOR;
        INIT_PZVAL(*rval);
-#if defined(HAVE_ATOF_ACCEPTS_NAN) && defined(HAVE_ATOF_ACCEPTS_INF)
-       ZVAL_DOUBLE(*rval, zend_strtod(start + 2, NULL));
-#else
+
        if (!strncmp(start + 2, "NAN", 3)) {
                ZVAL_DOUBLE(*rval, php_get_nan());
        } else if (!strncmp(start + 2, "INF", 3)) {
@@ -884,10 +882,10 @@ yy67:
        } else if (!strncmp(start + 2, "-INF", 4)) {
                ZVAL_DOUBLE(*rval, -php_get_inf());
        }
-#endif
+
        return 1;
 }
-#line 575 "<stdout>"
+#line 573 "<stdout>"
 yy68:  yych = *++YYCURSOR;
        if(yych == 'N') goto yy65;
        goto yy2;
@@ -923,7 +921,7 @@ yy74:
        ZVAL_LONG(*rval, parse_iv(start + 2));
        return 1;
 }
-#line 612 "<stdout>"
+#line 610 "<stdout>"
 yy75:  yych = *++YYCURSOR;
        if(yych <= '/') goto yy2;
        if(yych >= '2') goto yy2;
@@ -941,7 +939,7 @@ yy78:
        ZVAL_BOOL(*rval, parse_iv(start + 2));
        return 1;
 }
-#line 630 "<stdout>"
+#line 628 "<stdout>"
 yy79:  ++YYCURSOR;
        goto yy80;
 yy80:
@@ -952,7 +950,7 @@ yy80:
        ZVAL_NULL(*rval);
        return 1;
 }
-#line 641 "<stdout>"
+#line 639 "<stdout>"
 yy81:  yych = *++YYCURSOR;
        if(yych <= ','){
                if(yych != '+') goto yy2;
@@ -1001,7 +999,7 @@ yy86:
        
        return 1;
 }
-#line 691 "<stdout>"
+#line 689 "<stdout>"
 yy87:  yych = *++YYCURSOR;
        if(yych <= ','){
                if(yych != '+') goto yy2;
@@ -1048,9 +1046,9 @@ yy92:
        
        return 1;
 }
-#line 739 "<stdout>"
+#line 737 "<stdout>"
 }
-#line 578 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
+#line 576 "/home/rei/php_dev/php5/ext/standard/var_unserializer.re"
 
 
        return 0;
index ae577ce8360e0470e82c419f8a030a09f047cf3b..bb804545a2bfe2b2b79bc22ed2caf1ebee1751fa 100644 (file)
@@ -399,9 +399,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
 "d:" ("NAN" | "-"? "INF") ";"  {
        *p = YYCURSOR;
        INIT_PZVAL(*rval);
-#if defined(HAVE_ATOF_ACCEPTS_NAN) && defined(HAVE_ATOF_ACCEPTS_INF)
-       ZVAL_DOUBLE(*rval, zend_strtod(start + 2, NULL));
-#else
+
        if (!strncmp(start + 2, "NAN", 3)) {
                ZVAL_DOUBLE(*rval, php_get_nan());
        } else if (!strncmp(start + 2, "INF", 3)) {
@@ -409,7 +407,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
        } else if (!strncmp(start + 2, "-INF", 4)) {
                ZVAL_DOUBLE(*rval, -php_get_inf());
        }
-#endif
+
        return 1;
 }