com php-src: Print .0 in phpdbg opcode dumps: sapi/phpdbg/phpdb g_utils.c
| From: | Nikita Popov | Date: | Fri, 25 Mar 2016 18:11:32 +0000 |
| Subject: | com php-src: Print .0 in phpdbg opcode dumps: sapi/phpdbg/phpdb g_utils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91477@lists.php.net to get a copy of this message | ||
Commit: 24551ed6c8f9e8cee6d12aa792f83648eead7ff4
Author: Nikita Popov <nikic@php.net> Wed, 23 Mar 2016 19:14:22 +0100
Parents: 37c8bb58686b2d86f145ebe4fe39854f5951dcd7
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=24551ed6c8f9e8cee6d12aa792f83648eead7ff4
Log:
Print .0 in phpdbg opcode dumps
Changed paths:
M sapi/phpdbg/phpdbg_utils.c
Diff:
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 7158f3b..6f42665 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -804,6 +804,18 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
break;
case IS_DOUBLE:
spprintf(&decode, 0, "%.*G", 14, Z_DVAL_P(zv));
+
+ /* Make sure it looks like a float */
+ if (zend_finite(Z_DVAL_P(zv)) && !strchr(decode, '.')) {
+ size_t len = strlen(decode);
+ char *decode2 = emalloc(len + strlen(".0") + 1);
+ memcpy(decode2, decode, len);
+ decode2[len] = '.';
+ decode2[len+1] = '0';
+ decode2[len+2] = '\0';
+ efree(decode);
+ decode = decode2;
+ }
break;
case IS_STRING: {
int i;