From 6c61286da4f2d71e659da70842168d71835292f9 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 2 Oct 2015 11:43:52 +0200 Subject: [PATCH] Do not include zend_verify_return_type in executable ops (phpdbg) --- Zend/zend_compile.c | 4 +++- sapi/phpdbg/phpdbg.c | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ce3815c8649..98af0a7c746 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2042,6 +2042,7 @@ static void zend_emit_return_type_check(znode *expr, zend_arg_info *return_info) void zend_emit_final_return(zval *zv) /* {{{ */ { znode zn; + zend_op *ret; zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { @@ -2055,7 +2056,8 @@ void zend_emit_final_return(zval *zv) /* {{{ */ ZVAL_NULL(&zn.u.constant); } - zend_emit_op(NULL, returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN, &zn, NULL); + ret = zend_emit_op(NULL, returns_reference ? ZEND_RETURN_BY_REF : ZEND_RETURN, &zn, NULL); + ret->extended_value = -1; } /* }}} */ diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index cc3de4286f2..30edec4634e 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -443,14 +443,14 @@ static void phpdbg_oplog_fill_executable(zend_op_array *op_array, HashTable *ins ZVAL_LONG(&zero, 0); /* ignore autogenerated return (well, not too precise with finally branches, but that's okay) */ - if (op_array->last >= 1 && (end - 1)->opcode == ZEND_RETURN - && ((op_array->last > 1 && ((end - 2)->opcode == ZEND_RETURN || (end - 2)->opcode == ZEND_GENERATOR_RETURN || (end - 2)->opcode == ZEND_THROW)) - || op_array->function_name == NULL)) { + if (op_array->last >= 1 && (((end - 1)->opcode == ZEND_RETURN || (end - 1)->opcode == ZEND_RETURN_BY_REF || (end - 1)->opcode == ZEND_GENERATOR_RETURN) + && ((op_array->last > 1 && ((end - 2)->opcode == ZEND_RETURN || (end - 2)->opcode == ZEND_RETURN_BY_REF || (end - 2)->opcode == ZEND_GENERATOR_RETURN || (end - 2)->opcode == ZEND_THROW)) + || op_array->function_name == NULL || (end - 1)->extended_value == -1))) { end--; } for (; cur < end; cur++) { - if (cur->opcode == ZEND_NOP || cur->opcode == ZEND_OP_DATA || cur->opcode == ZEND_FE_FREE || cur->opcode == ZEND_FREE || cur->opcode == ZEND_ASSERT_CHECK + if (cur->opcode == ZEND_NOP || cur->opcode == ZEND_OP_DATA || cur->opcode == ZEND_FE_FREE || cur->opcode == ZEND_FREE || cur->opcode == ZEND_ASSERT_CHECK || cur->opcode == ZEND_VERIFY_RETURN_TYPE || cur->opcode == ZEND_DECLARE_CONST || cur->opcode == ZEND_DECLARE_CLASS || cur->opcode == ZEND_DECLARE_INHERITED_CLASS || cur->opcode == ZEND_DECLARE_FUNCTION || cur->opcode == ZEND_DECLARE_INHERITED_CLASS_DELAYED || cur->opcode == ZEND_VERIFY_ABSTRACT_CLASS || cur->opcode == ZEND_ADD_TRAIT || cur->opcode == ZEND_BIND_TRAITS || cur->opcode == ZEND_DECLARE_ANON_CLASS || cur->opcode == ZEND_DECLARE_ANON_INHERITED_CLASS || cur->opcode == ZEND_FAST_RET || cur->opcode == ZEND_TICKS