]> granicus.if.org Git - php/commitdiff
Stop using zend_function->reserved[] space.
authorDmitry Stogov <dmitry@zend.com>
Wed, 22 Aug 2018 07:43:51 +0000 (10:43 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 22 Aug 2018 07:43:51 +0000 (10:43 +0300)
Zend/zend_closures.c
Zend/zend_object_handlers.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 494c8892218fb128ec9522725aea3e6ea7c0c924..56808e2496e91b59bf4655daa03600f2ee566fab 100644 (file)
@@ -234,7 +234,8 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
        fci.size = sizeof(zend_fcall_info);
        fci.retval = return_value;
 
-       fcc.function_handler = (zend_function *) EX(func)->internal_function.reserved[0];
+       fcc.function_handler = (EX(func)->internal_function.fn_flags & ZEND_ACC_STATIC) ?
+               EX(func)->internal_function.scope->__callstatic : EX(func)->internal_function.scope->__call;
        fci.params = params;
        fci.param_count = 2;
        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,
                memset(&call, 0, sizeof(zend_internal_function));
 
                call.type = ZEND_INTERNAL_FUNCTION;
+               call.fn_flags = mptr->common.fn_flags & ZEND_ACC_STATIC;
                call.handler = zend_closure_call_magic;
                call.function_name = mptr->common.function_name;
-               call.reserved[0] = mptr->op_array.reserved[0];
                call.scope = mptr->common.scope;
 
                zend_free_trampoline(mptr);
index ab7c06859e0afd4a64875cfd759f46a2f09bd01b..fde7b1204cfcbc56a32956698bd44cf3d556d610 100644 (file)
@@ -1161,7 +1161,6 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend
        }
        func->opcodes = &EG(call_trampoline_op);
        func->run_time_cache = (void*)(intptr_t)-1;
-       func->reserved[0] = fbc;
        func->scope = fbc->common.scope;
        /* reserve space for arguments, local and temorary variables */
        func->T = (fbc->type == ZEND_USER_FUNCTION)? MAX(fbc->op_array.last_var + fbc->op_array.T, 2) : 2;
index 9711665ec979776eedce4fb5161897779154739c..fd250cb8cb5a05a427aba588fa8f45fef29b8f53 100644 (file)
@@ -7725,7 +7725,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
        call = execute_data;
        execute_data = EG(current_execute_data) = EX(prev_execute_data);
 
-       call->func = fbc->op_array.reserved[0];
+       call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call;
        ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call));
        ZEND_CALL_NUM_ARGS(call) = 2;
 
index 0b390b812632e418d91ef694064e4dd750d1f4ce..35ab7dda5c48cf90310a3a0d9258e85f284fee93 100644 (file)
@@ -1942,7 +1942,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
        call = execute_data;
        execute_data = EG(current_execute_data) = EX(prev_execute_data);
 
-       call->func = fbc->op_array.reserved[0];
+       call->func = (fbc->op_array.fn_flags & ZEND_ACC_STATIC) ? fbc->op_array.scope->__callstatic : fbc->op_array.scope->__call;
        ZEND_ASSERT(zend_vm_calc_used_stack(2, call->func) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call));
        ZEND_CALL_NUM_ARGS(call) = 2;