summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-09-29 01:09:36 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-09-29 01:09:36 +0000
commit5646e5f74769164133f658d91bbe613003d5c6ab (patch)
tree98bbf28df160d89c03689a3d0865fd8787c10d3a
parentee9deb187a357ab093f81bdc96177da34b11dae5 (diff)
downloadphp-git-5646e5f74769164133f658d91bbe613003d5c6ab.tar.gz
MFH: Fixed Bug #25665 (var_dump() hangs on Nan and INF).
-rw-r--r--NEWS1
-rw-r--r--main/spprintf.c20
2 files changed, 19 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c6e4ada65c..1e08a4a7b2 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP 4 NEWS
- 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)
diff --git a/main/spprintf.c b/main/spprintf.c
index 9f22880059..ee6991a3d0 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -473,6 +473,23 @@ static int xbuf_format_converter(register xbuffy * xbuf, const char *fmt, va_lis
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 @@ static int xbuf_format_converter(register xbuffy * xbuf, const char *fmt, va_lis
/*
* * 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)