Skip to content

Commit 8d95f56

Browse files
committed
Stop using zend_function->reserved[] space.
1 parent 0f68ff5 commit 8d95f56

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Zend/zend_closures.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
234234
fci.size = sizeof(zend_fcall_info);
235235
fci.retval = return_value;
236236

237-
fcc.function_handler = (zend_function *) EX(func)->internal_function.reserved[0];
237+
fcc.function_handler = (EX(func)->internal_function.fn_flags & ZEND_ACC_STATIC) ?
238+
EX(func)->internal_function.scope->__callstatic : EX(func)->internal_function.scope->__call;
238239
fci.params = params;
239240
fci.param_count = 2;
240241
ZVAL_STR(&fci.params[0], EX(func)->common.function_name);
@@ -270,9 +271,9 @@ static int zend_create_closure_from_callable(zval *return_value, zval *callable,
270271
memset(&call, 0, sizeof(zend_internal_function));
271272

272273
call.type = ZEND_INTERNAL_FUNCTION;
274+
call.fn_flags = mptr->common.fn_flags & ZEND_ACC_STATIC;
273275
call.handler = zend_closure_call_magic;
274276
call.function_name = mptr->common.function_name;
275-
call.reserved[0] = mptr->op_array.reserved[0];
276277
call.scope = mptr->common.scope;
277278

278279
zend_free_trampoline(mptr);

Zend/zend_object_handlers.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,6 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend
11611161
}
11621162
func->opcodes = &EG(call_trampoline_op);
11631163
func->run_time_cache = (void*)(intptr_t)-1;
1164-
func->reserved[0] = fbc;
11651164
func->scope = fbc->common.scope;
11661165
/* reserve space for arguments, local and temorary variables */
11671166
func->T = (fbc->type == ZEND_USER_FUNCTION)? MAX(fbc->op_array.last_var + fbc->op_array.T, 2) : 2;

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7725,7 +7725,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
77257725
call = execute_data;
77267726
execute_data = EG(current_execute_data) = EX(prev_execute_data);
77277727

7728-
call->func = fbc->op_array.reserved[0];
7728+
call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call;
77297729
ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call));
77307730
ZEND_CALL_NUM_ARGS(call) = 2;
77317731

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
19421942
call = execute_data;
19431943
execute_data = EG(current_execute_data) = EX(prev_execute_data);
19441944

1945-
call->func = fbc->op_array.reserved[0];
1945+
call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call;
19461946
ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call));
19471947
ZEND_CALL_NUM_ARGS(call) = 2;
19481948

0 commit comments

Comments
 (0)