Skip to content

zend_vm_gen: Fix GET_OP*_OBJ_ZVAL_PTR_DEREF for ANY #18746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ typedef int (ZEND_FASTCALL *incdec_t)(zval *);
#define get_zval_ptr_ptr(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
#define get_zval_ptr_ptr_undef(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
#define get_obj_zval_ptr(op_type, node, type) _get_obj_zval_ptr(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
#define get_obj_zval_ptr_deref(op_type, node, type) _get_obj_zval_ptr_deref(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
#define get_obj_zval_ptr_undef(op_type, node, type) _get_obj_zval_ptr_undef(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
#define get_obj_zval_ptr_ptr(op_type, node, type) _get_obj_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)

Expand Down Expand Up @@ -537,6 +538,14 @@ static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_o
return get_zval_ptr(op_type, op, type);
}

static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_deref(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
return &EX(This);
}
return get_zval_ptr_deref(op_type, op, type);
}

static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
);

$op1_get_obj_zval_ptr_deref = array(
"ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, \\1)",
"ANY" => "get_obj_zval_ptr_deref(opline->op1_type, opline->op1, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
Expand All @@ -374,7 +374,7 @@
);

$op2_get_obj_zval_ptr_deref = array(
"ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, \\1)",
"ANY" => "get_obj_zval_ptr_deref(opline->op2_type, opline->op2, \\1)",
"TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
Expand Down