summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_utils.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-07-21 12:27:50 +0200
committerAnatol Belski <ab@php.net>2015-07-21 12:27:50 +0200
commitb148ef44965651fcbe93e8ee35a14edc087ef17c (patch)
treef5c53fb3d448d0174610d077e0bf3c8bd76834b2 /sapi/phpdbg/phpdbg_utils.c
parentad8a73dd55c087de465ad80e8715611693bb1460 (diff)
parent6065b29fe41f09e01dd06ba21980e0344f13230c (diff)
downloadphp-git-b148ef44965651fcbe93e8ee35a14edc087ef17c.tar.gz
Merge branch 'master' into PHP-7.0.0
* master: (204 commits) Reverted ad4533fdbabcc3e545277e30023b2fdce16297a0 update UPGRADING updated NEWS fix comment libwebp support for linux Replaced libvpx by libwebp (first draft; Windows only) update news with bug #70022 Change E_ERROR and some E_WARNING to E_RECOVERABLE_ERROR. Add tests for json_last_error()/json_last_error_msg() failures updated NEWS updated NEWS Exclude opcache from a few opcode related tests updated NEWS updated NEWS Fix #66387: Stack overflow with imagefilltoborder Fix various Windows issues (e.g. dir separators) Remove bogus exception_save() from FETCH_CLASS Fix readline/libedit build Do not use readline when not having a tty This is important for e.g. run-tests.php Add show_unexecuted option to phpdbg_end_oplog() ... Conflicts: Zend/tests/temporary_cleaning_001.phpt Zend/tests/temporary_cleaning_003.phpt Zend/tests/temporary_cleaning_004.phpt Zend/tests/temporary_cleaning_005.phpt Zend/zend_compile.c Zend/zend_compile.h sapi/phpdbg/phpdbg_opcode.c
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.c')
-rw-r--r--sapi/phpdbg/phpdbg_utils.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 112f340d6b..2e1e1ed70c 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -728,11 +728,11 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
op_num = op - op_array->opcodes;
- for (i = 0; i < op_array->last_try_catch && op_array->try_catch_array[i].try_op < op_num; i++) {
+ for (i = 0; i < op_array->last_try_catch && op_array->try_catch_array[i].try_op <= op_num; i++) {
uint32_t catch = op_array->try_catch_array[i].catch_op, finally = op_array->try_catch_array[i].finally_op;
if (op_num <= catch || op_num <= finally) {
- if (finally && finally < catch) {
- return 0;
+ if (finally) {
+ return 1;
}
do {
@@ -764,22 +764,22 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
switch (Z_TYPE_P(zv)) {
case IS_UNDEF:
- decode = zend_strndup("", 0);
+ decode = estrdup("");
break;
case IS_NULL:
- decode = zend_strndup(ZEND_STRL("null"));
+ decode = estrdup("null");
break;
case IS_FALSE:
- decode = zend_strndup(ZEND_STRL("false"));
+ decode = estrdup("false");
break;
case IS_TRUE:
- decode = zend_strndup(ZEND_STRL("true"));
+ decode = estrdup("true");
break;
case IS_LONG:
- asprintf(&decode, ZEND_ULONG_FMT, Z_LVAL_P(zv));
+ spprintf(&decode, 0, ZEND_LONG_FMT, Z_LVAL_P(zv));
break;
case IS_DOUBLE:
- asprintf(&decode, "%.*G", 14, Z_DVAL_P(zv));
+ spprintf(&decode, 0, "%.*G", 14, Z_DVAL_P(zv));
break;
case IS_STRING: {
int i;
@@ -789,28 +789,32 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
ZSTR_VAL(str)[i] = ' ';
}
}
- asprintf(&decode, "\"%.*s\"%c", ZSTR_LEN(str) <= maxlen - 2 ? (int) ZSTR_LEN(str) : (maxlen - 3), ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen - 2 ? 0 : '+');
+ spprintf(&decode, 0, "\"%.*s\"%c",
+ ZSTR_LEN(str) <= maxlen - 2 ? (int) ZSTR_LEN(str) : (maxlen - 3),
+ ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen - 2 ? 0 : '+');
zend_string_release(str);
} break;
case IS_RESOURCE:
- asprintf(&decode, "Rsrc #%d", Z_RES_HANDLE_P(zv));
+ spprintf(&decode, 0, "Rsrc #%d", Z_RES_HANDLE_P(zv));
break;
case IS_ARRAY:
- asprintf(&decode, "array(%d)", zend_hash_num_elements(Z_ARR_P(zv)));
+ spprintf(&decode, 0, "array(%d)", zend_hash_num_elements(Z_ARR_P(zv)));
break;
case IS_OBJECT: {
zend_string *str = Z_OBJCE_P(zv)->name;
- asprintf(&decode, "%.*s%c", ZSTR_LEN(str) <= maxlen ? (int) ZSTR_LEN(str) : maxlen - 1, ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+');
+ spprintf(&decode, 0, "%.*s%c",
+ ZSTR_LEN(str) <= maxlen ? (int) ZSTR_LEN(str) : maxlen - 1,
+ ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+');
break;
}
case IS_CONSTANT:
- decode = zend_strndup(ZEND_STRL("<constant>"));
+ decode = estrdup("<constant>");
break;
case IS_CONSTANT_AST:
- decode = zend_strndup(ZEND_STRL("<ast>"));
+ decode = estrdup("<ast>");
break;
default:
- asprintf(&decode, "unknown type: %d", Z_TYPE_P(zv));
+ spprintf(&decode, 0, "unknown type: %d", Z_TYPE_P(zv));
break;
}