summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-01-30 16:38:53 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-01-30 16:38:53 +0000
commit112eb3b35dc85c81cffcc7627d11414d5467e417 (patch)
treeb0d200d1467483c5f31ad7f7e419a2b91ec95663
parentc73882617ed0a890b9c266ca4431699975e197ef (diff)
downloadphp-git-112eb3b35dc85c81cffcc7627d11414d5467e417.tar.gz
Fix handling of INF/NAN in unserialize().
-rw-r--r--ext/standard/var_unserializer.c36
-rw-r--r--ext/standard/var_unserializer.re6
2 files changed, 19 insertions, 23 deletions
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 35e934b160..ac340e68d7 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.3 on Wed Jan 26 11:09:50 2005 */
+/* Generated by re2c 0.9.3 on Sun Jan 30 11:34:19 2005 */
#line 1 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 574 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 568 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 475 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 467 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 449 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 421 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 414 "/home/rei/php_dev/php5.1/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.1/ext/standard/var_unserializer.re"
+#line 576 "/home/rei/php_dev/php5.1/ext/standard/var_unserializer.re"
return 0;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 7efc240798..c520302d1e 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -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;
}