com php-src: Fixed wrong exception when passing element of typed property by reference.: Zend/tests/type_declarations/typed_propertie s_055.phpt
Zend/zend_compile.c Zend/zend_co mpile.h Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_gen.php Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h e xt/opcache/Optimizer/zend_dump.c

From: Date: Wed, 25 May 2016 14:57:29 +0000
Subject: com php-src: Fixed wrong exception when passing element of typed property by reference.: Zend/tests/type_declarations/typed_propertie s_055.phpt
Zend/zend_compile.c Zend/zend_co mpile.h Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_gen.php Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h e xt/opcache/Optimizer/zend_dump.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95522@lists.php.net to get a copy of this message
Commit: 023df779628157bd07121fc05f9ee8763a7788ab Author: Dmitry Stogov <dmitry@zend.com> Wed, 25 May 2016 17:57:29 +0300 Parents: 05dd2e462aab2543a5caf2b9c1cf90d6014c1b27 Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=023df779628157bd07121fc05f9ee8763a7788ab Log: Fixed wrong exception when passing element of typed property by reference. Changed paths: A Zend/tests/type_declarations/typed_properties_055.phpt M Zend/zend_compile.c M Zend/zend_compile.h M Zend/zend_execute.c M Zend/zend_vm_def.h M Zend/zend_vm_execute.h M Zend/zend_vm_gen.php M Zend/zend_vm_opcodes.c M Zend/zend_vm_opcodes.h M ext/opcache/Optimizer/zend_dump.c

diff --git a/Zend/tests/type_declarations/typed_properties_055.phpt b/Zend/tests/type_declarations/typed_properties_055.phpt new file mode 100644 index 0000000..16c958a --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_055.phpt @@ -0,0 +1,27 @@ +--TEST-- +Default values of callable properties +--FILE-- +<?php +class A { + public $foo = 1; + public int $bar = 2; +} +class B { + public A $a; +} +$f = function (&$n) { + var_dump($n); + $i = "ops"; +}; +$o = new B; +$o->a = new A; +$f($o->a->foo); +$f($o->a->bar); +?> +--EXPECTF-- +int(1) + +Fatal error: Uncaught TypeError: Typed property A::$bar must not be referenced in %styped_properties_055.php:16 +Stack trace: +#0 {main} + thrown in %styped_properties_055.php on line 16 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6b657d7..3505b18 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2693,7 +2693,7 @@ void zend_compile_prop(znode *result, zend_ast *ast, uint32_t type, int by_ref) zend_op *opline = zend_compile_prop_common(result, ast, type); zend_adjust_for_fetch_type(opline, type); if (by_ref) { - opline->extended_value = 1; + opline->extended_value |= ZEND_FETCH_REF; } } /* }}} */ @@ -3137,7 +3137,7 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */ } } else { zend_compile_var(&arg_node, arg, - BP_VAR_FUNC_ARG | (arg_num << BP_VAR_SHIFT), 0); + BP_VAR_FUNC_ARG | (arg_num << BP_VAR_SHIFT), 1); opcode = ZEND_SEND_VAR_EX; } } else { @@ -3515,7 +3515,7 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam zend_bool send_user = 0; if (zend_is_variable(arg_ast) && !zend_is_call(arg_ast)) { - zend_compile_var(&arg_node, arg_ast, BP_VAR_FUNC_ARG | (i << BP_VAR_SHIFT), 0); + zend_compile_var(&arg_node, arg_ast, BP_VAR_FUNC_ARG | (i << BP_VAR_SHIFT), 1); send_user = 1; } else { zend_compile_expr(&arg_node, arg_ast); @@ -7978,7 +7978,7 @@ void zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type, int b opline = zend_delayed_compile_prop(result, ast, type); zend_adjust_for_fetch_type(opline, type); if (by_ref) { - opline->extended_value = 1; + opline->extended_value |= ZEND_FETCH_REF; } return; case ZEND_AST_STATIC_PROP: diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 4609d74..1b23eed 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -894,6 +894,7 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name); #define ZEND_ISEMPTY 0x01000000 #define ZEND_ISSET_ISEMPTY_MASK (ZEND_ISSET | ZEND_ISEMPTY) #define ZEND_QUICK_SET 0x00800000 +#define ZEND_FETCH_REF 0x00400000 #define ZEND_FETCH_ARG_MASK 0x000fffff diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ad58d17..88e392d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2046,7 +2046,7 @@ ZEND_API void zend_fetch_dimension_by_zval_is(zval *result, zval *container, zva } -static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type, int by_ref) +static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type, uint32_t by_ref) { zval *ptr; @@ -2087,7 +2087,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c if (EXPECTED(Z_TYPE_P(ptr) != IS_UNDEF)) { return_indirect: ZVAL_INDIRECT(result, ptr); - if (by_ref + if ((by_ref & ZEND_FETCH_REF) && (prop_op_type == IS_CONST || EXPECTED(Z_TYPE_P(prop_ptr) == IS_STRING))) { zend_property_info *prop_info; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e931aa2..182d1ba 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1947,7 +1947,7 @@ ZEND_VM_C_LABEL(fetch_obj_r_no_object): ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); } -ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV) +ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF) { USE_OPLINE zend_free_op free_op1, free_op2; @@ -2071,7 +2071,7 @@ ZEND_VM_C_LABEL(fetch_obj_is_no_object): ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); } -ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, NUM) +ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, NUM|FETCH_REF) { USE_OPLINE zval *container; @@ -2096,7 +2096,7 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THIS|CV, CONST FREE_OP1_VAR_PTR(); HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); FREE_OP2(); if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d0ecee7..f8d9545 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -5074,7 +5074,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_ HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -8893,7 +8893,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_ HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -10800,7 +10800,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_ HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); zval_ptr_dtor_nogc(free_op2); if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -13206,7 +13206,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CO HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -14424,7 +14424,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -14946,7 +14946,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TM HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_TMP_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); zval_ptr_dtor_nogc(free_op2); if (IS_TMP_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -18262,7 +18262,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CO if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -23359,7 +23359,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -26560,7 +26560,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TM if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}; HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); zval_ptr_dtor_nogc(free_op2); if (IS_VAR == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -29393,7 +29393,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -33131,7 +33131,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -35757,7 +35757,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); zval_ptr_dtor_nogc(free_op2); if (IS_UNUSED == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -41184,7 +41184,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CON HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -48328,7 +48328,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_ HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); @@ -52603,7 +52603,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP HANDLE_EXCEPTION(); } - zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 1); + zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, opline->extended_value); zval_ptr_dtor_nogc(free_op2); if (IS_CV == IS_VAR && READY_TO_DESTROY(free_op1)) { EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var)); diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 03d9817..9e2944a 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -74,9 +74,10 @@ $vm_op_flags = array( "ZEND_VM_EXT_ARG_NUM" => 1<<18, "ZEND_VM_EXT_ARRAY_INIT" => 1<<19, "ZEND_VM_EXT_REF" => 1<<20, + "ZEND_VM_EXT_FETCH_REF" => 1<<21, "ZEND_VM_EXT_MASK" => 0x0f000000, "ZEND_VM_EXT_NUM" => 0x01000000, - // unused 0x2000000 + // unused 0x02000000, "ZEND_VM_EXT_JMP_ADDR" => 0x03000000, "ZEND_VM_EXT_DIM_OBJ" => 0x04000000, "ZEND_VM_EXT_CLASS_FETCH" => 0x05000000, @@ -129,6 +130,7 @@ $vm_ext_decode = array( "REF" => ZEND_VM_EXT_REF, "SRC" => ZEND_VM_EXT_SRC, "SEND" => ZEND_VM_EXT_SEND, + "FETCH_REF" => ZEND_VM_EXT_FETCH_REF, ); $vm_kind_name = array( diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index 5463f9c..9ea4d21 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -294,7 +294,7 @@ static uint32_t zend_vm_opcodes_flags[184] = { 0x00000753, 0x00010107, 0x00006701, - 0x00000751, + 0x00200751, 0x00010107, 0x00006701, 0x00000751, @@ -303,7 +303,7 @@ static uint32_t zend_vm_opcodes_flags[184] = { 0x00000757, 0x00050107, 0x01006703, - 0x01000753, + 0x01200753, 0x00010107, 0x00000701, 0x00000751, diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 4f5a0d6..a3c7a3b 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -46,6 +46,7 @@ #define ZEND_VM_EXT_ARG_NUM 0x00040000 #define ZEND_VM_EXT_ARRAY_INIT 0x00080000 #define ZEND_VM_EXT_REF 0x00100000 +#define ZEND_VM_EXT_FETCH_REF 0x00200000 #define ZEND_VM_EXT_MASK 0x0f000000 #define ZEND_VM_EXT_NUM 0x01000000 #define ZEND_VM_EXT_JMP_ADDR 0x03000000 diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c index c306c7a..9429156 100644 --- a/ext/opcache/Optimizer/zend_dump.c +++ b/ext/opcache/Optimizer/zend_dump.c @@ -555,6 +555,11 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block * fprintf(stderr, " (ref)"); } } + if (ZEND_VM_EXT_FETCH_REF & flags) { + if (opline->extended_value & ZEND_FETCH_REF) { + fprintf(stderr, " (ref)"); + } + } } if (opline->op1_type == IS_CONST) {
« previous php.cvs (#95522) next »