Skip to content
Merged
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
12 changes: 6 additions & 6 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ ZEND_API const zend_function *zend_get_closure_method_def(zend_object *obj) /* {
}
/* }}} */

ZEND_API zend_object* zend_get_closure_this_ptr(zval *obj) /* {{{ */
ZEND_API zend_object* zend_get_closure_this_ptr(zend_object *closure_zobj) /* {{{ */
{
zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
zend_closure *closure = (zend_closure *)closure_zobj;
return closure->this_ptr;
}
/* }}} */
Expand Down Expand Up @@ -982,17 +982,17 @@ void zend_closure_from_frame(zval *return_value, const zend_execute_data *call)
}
} /* }}} */

void zend_closure_bind_var(zval *closure_zv, zend_string *var_name, zval *var) /* {{{ */
void zend_closure_bind_var(zend_object *closure_zobj, zend_string *var_name, zval *var) /* {{{ */
{
zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv);
zend_closure *closure = (zend_closure *) closure_zobj;
HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr);
zend_hash_update(static_variables, var_name, var);
}
/* }}} */

void zend_closure_bind_var_ex(zval *closure_zv, uint32_t offset, zval *val) /* {{{ */
void zend_closure_bind_var_ex(zend_object *closure_zobj, uint32_t offset, zval *val) /* {{{ */
{
zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv);
zend_closure *closure = (zend_closure *) closure_zobj;
HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr);
zval *var = (zval*)((char*)static_variables->arData + offset);
zval_ptr_dtor(var);
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_closures.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ BEGIN_EXTERN_C()
((zend_object*)((char*)(op_array) - sizeof(zend_object)))

void zend_register_closure_ce(void);
void zend_closure_bind_var(zval *closure_zv, zend_string *var_name, zval *var);
void zend_closure_bind_var_ex(zval *closure_zv, uint32_t offset, zval *val);
void zend_closure_bind_var(zend_object *closure_zobj, zend_string *var_name, zval *var);
void zend_closure_bind_var_ex(zend_object *closure_zobj, uint32_t offset, zval *val);
void zend_closure_from_frame(zval *closure_zv, const zend_execute_data *frame);

extern ZEND_API zend_class_entry *zend_ce_closure;
Expand All @@ -39,7 +39,7 @@ ZEND_API void zend_create_fake_closure(zval *res, zend_function *op_array, zend_
ZEND_API void zend_create_partial_closure(zval *res, zend_function *func, zend_class_entry *scope, zend_class_entry *called_scope, zend_object *this_ptr, bool partial_of_closure);
ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *obj);
ZEND_API const zend_function *zend_get_closure_method_def(zend_object *obj);
ZEND_API zend_object* zend_get_closure_this_ptr(zval *obj);
ZEND_API zend_object* zend_get_closure_this_ptr(zend_object *closure_zobj);

END_EXTERN_C()

Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_partial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ static void zp_bind(zval *result, zend_function *function, uint32_t argc, zval *
zval var;
ZVAL_OBJ(&var, ZEND_CLOSURE_OBJECT(function));
Z_ADDREF(var);
zend_closure_bind_var_ex(result, bind_offset, &var);
zend_closure_bind_var_ex(Z_OBJ_P(result), bind_offset, &var);
bind_offset += sizeof(Bucket);
}

Expand Down Expand Up @@ -1119,15 +1119,15 @@ static void zp_bind(zval *result, zend_function *function, uint32_t argc, zval *
return;
}
ZEND_ASSERT(zp_arg_must_be_sent_by_ref(function, offset+1) ? Z_ISREF_P(var) : !Z_ISREF_P(var));
zend_closure_bind_var_ex(result, bind_offset, var);
zend_closure_bind_var_ex(Z_OBJ_P(result), bind_offset, var);
bind_offset += sizeof(Bucket);
}

if (extra_named_params) {
zval var;
ZVAL_ARR(&var, extra_named_params);
Z_ADDREF(var);
zend_closure_bind_var_ex(result, bind_offset, &var);
zend_closure_bind_var_ex(Z_OBJ_P(result), bind_offset, &var);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -9248,7 +9248,7 @@ ZEND_VM_HANDLER(182, ZEND_BIND_LEXICAL, TMP, CV, REF)
Z_TRY_ADDREF_P(var);
}

zend_closure_bind_var_ex(closure,
zend_closure_bind_var_ex(Z_OBJ_P(closure),
(opline->extended_value & ~(ZEND_BIND_REF|ZEND_BIND_IMPLICIT)), var);
ZEND_VM_NEXT_OPCODE();
}
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getClosureThis)

GET_REFLECTION_OBJECT();
if (!Z_ISUNDEF(intern->obj)) {
zend_object *closure_this = zend_get_closure_this_ptr(&intern->obj);
zend_object *closure_this = zend_get_closure_this_ptr(Z_OBJ(intern->obj));
if (closure_this) {
RETURN_OBJ_COPY(closure_this);
}
Expand Down
Loading