summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-01-31 22:39:30 +0300
committerDmitry Stogov <dmitry@zend.com>2018-01-31 22:39:30 +0300
commitba298725d194f753c0220bd9ac482e3d257a9ddc (patch)
tree5ecb20ba5c368ea2b605c52ac3409492419dba26 /sapi
parent3c6e1c2b817179f35d6822d7576866834728561d (diff)
downloadphp-git-ba298725d194f753c0220bd9ac482e3d257a9ddc.tar.gz
Changed CATCH instruction format (extended_value moved into op2, op2 into result, result into extended_value)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c8
-rw-r--r--sapi/phpdbg/phpdbg_utils.c12
-rw-r--r--sapi/phpdbg/tests/exceptions_003.phpt2
-rw-r--r--sapi/phpdbg/tests/stepping_001.phpt2
4 files changed, 17 insertions, 7 deletions
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 313bb4fae8..4b3bf4c668 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -115,7 +115,13 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *opline) /*{{{ */
/* RESULT */
switch (opline->opcode) {
case ZEND_CATCH:
- spprintf(&decode[3], 0, "%" PRIu32, opline->result.num);
+ if (opline->extended_value == ZEND_LAST_CATCH) {
+ if (decode[2]) {
+ efree(decode[2]);
+ decode[2] = NULL;
+ }
+ }
+ decode[3] = phpdbg_decode_op(ops, opline, &opline->result, opline->result_type);
break;
default:
decode[3] = phpdbg_decode_op(ops, opline, &opline->result, opline->result_type);
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 005015d850..cdee919f79 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -760,9 +760,9 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
return 1;
}
- do {
+ cur = &op_array->opcodes[catch];
+ while (1) {
zend_class_entry *ce;
- cur = &op_array->opcodes[catch];
if (!(ce = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(cur, cur->op1))))) {
ce = zend_fetch_class_by_name(Z_STR_P(RT_CONSTANT(cur, cur->op1)), RT_CONSTANT(cur, cur->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
@@ -773,8 +773,12 @@ PHPDBG_API zend_bool phpdbg_check_caught_ex(zend_execute_data *execute_data, zen
return 1;
}
- catch += cur->extended_value / sizeof(zend_op);
- } while (!cur->result.num);
+ if (cur->extended_value == ZEND_LAST_CATCH) {
+ return 0;
+ }
+
+ cur = OP_JMP_ADDR(cur, cur->op2);
+ }
return 0;
}
diff --git a/sapi/phpdbg/tests/exceptions_003.phpt b/sapi/phpdbg/tests/exceptions_003.phpt
index 9d4abc0739..e78ff1d489 100644
--- a/sapi/phpdbg/tests/exceptions_003.phpt
+++ b/sapi/phpdbg/tests/exceptions_003.phpt
@@ -26,7 +26,7 @@ prompt> [L7 %s ECHO<1> "ok\n"
00009: } catch (Error $e) {
prompt> ok
[L7 %s FAST_RET ~%d try-catch(0) %s]
-[L9 %s CATCH<-%d> "Error" $e 1 %s]
+[L9 %s CATCH<1> "Error" $e %s]
>00005: x();
00006: } finally {
00007: print "ok\n";
diff --git a/sapi/phpdbg/tests/stepping_001.phpt b/sapi/phpdbg/tests/stepping_001.phpt
index e8e32db0be..a7ab9e59aa 100644
--- a/sapi/phpdbg/tests/stepping_001.phpt
+++ b/sapi/phpdbg/tests/stepping_001.phpt
@@ -25,7 +25,7 @@ prompt> [L0 %s HANDLE_EXCEPTION
00005: }
00006:
prompt> [L0 %s HANDLE_EXCEPTION %s]
-[L9 %s CATCH<-%d> "Exception" $e 1 %s]
+[L9 %s CATCH<1> "Exception" $e %s]
>00008: foo();
00009: } catch (Exception $e) {
00010: echo "ok";