diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_utils.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 7158f3ba6c..642c1dec63 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -532,7 +532,7 @@ PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable last_index[index_len] = 0; if (!(zv = zend_symtable_str_find(parent, last_index, index_len))) { if (!silent) { - phpdbg_error("variable", "type=\"undefined\" variable=\"%.*s\"", "%.*s is undefined", (int) i, input); + phpdbg_error("variable", "type=\"undefined\" variable=\"%.*s\"", "%.*s is undefined", (int) input[i] == ']' ? i + 1 : i, input); } return FAILURE; } @@ -772,7 +772,7 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen return 1; } - catch = cur->extended_value; + catch += cur->extended_value / sizeof(zend_op); } while (!cur->result.num); return 0; @@ -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; |