iliaa Sun Sep 28 21:09:37 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src NEWS
/php-src/main spprintf.c
Log:
MFH: Fixed Bug #25665 (var_dump() hangs on Nan and INF).
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.410 php-src/NEWS:1.1247.2.411
--- php-src/NEWS:1.1247.2.410 Fri Sep 26 14:00:00 2003
+++ php-src/NEWS Sun Sep 28 21:09:16 2003
@@ -8,6 +8,7 @@
- Fixed memory leak in gethostbynamel() if an error occurs. (Sara)
- Fixed FastCGI being unable to bind to a specific IP. (Sascha)
- Fixed bug #25671 (str_replace corrupting subarrays). (Sara)
+- Fixed Bug #25665 (var_dump() hangs on Nan and INF). (Ilia)
- Fixed bug #25648 (xslt_set_encoding() being not detected correctly). (Jani)
- Fixed bug #25636 (SNMP Session not closed on success). (Ilia,
nesslage[at]mwsc[dot]edu)
Index: php-src/main/spprintf.c
diff -u php-src/main/spprintf.c:1.10.4.1 php-src/main/spprintf.c:1.10.4.2
--- php-src/main/spprintf.c:1.10.4.1 Tue Dec 31 11:26:27 2002
+++ php-src/main/spprintf.c Sun Sep 28 21:09:36 2003
@@ -473,6 +473,23 @@
case 'g':
case 'G':
+ fp_num = va_arg(ap, double);
+
+ if (zend_isnan(fp_num)) {
+ s = "NAN";
+ s_len = 3;
+ break;
+ } else if (zend_isinf(fp_num)) {
+ if (fp_num > 0) {
+ s = "INF";
+ s_len = 3;
+ } else {
+ s = "-INF";
+ s_len = 4;
+ }
+ break;
+ }
+
if (adjust_precision == NO)
precision = FLOAT_DIGITS;
else if (precision == 0)
@@ -480,8 +497,7 @@
/*
* * We use &num_buf[ 1 ], so that we have
room for the sign
*/
- s = ap_php_gcvt(va_arg(ap, double), precision,
&num_buf[1],
- alternate_form);
+ s = ap_php_gcvt(fp_num, precision,
&num_buf[1], alternate_form);
if (*s == '-')
prefix_char = *s++;
else if (print_sign)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php