]> granicus.if.org Git - php/commitdiff
zend_fcall_info_cache.initialized is removed (zend_fcall_info_cache is initialized...
authorDmitry Stogov <dmitry@zend.com>
Wed, 27 Dec 2017 12:15:03 +0000 (15:15 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 27 Dec 2017 12:15:03 +0000 (15:15 +0300)
15 files changed:
UPGRADING.INTERNALS
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_closures.c
Zend/zend_execute_API.c
Zend/zend_interfaces.c
ext/mysqli/mysqli.c
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
ext/pgsql/pgsql.c
ext/reflection/php_reflection.c
ext/spl/php_spl.c
ext/spl/spl_directory.c
ext/spl/spl_engine.h
main/streams/userspace.c

index 7b03440a53b6aa5a5fc1aeaf831e0654739146ed..040498e38736c99eef33b05412f706754fbcb393 100644 (file)
@@ -11,6 +11,7 @@ PHP 7.3 INTERNALS UPGRADE NOTES
   h. zend_register_persistent_resource()
   i. RAND_RANGE()
   j. cast_object() with _IS_NUMBER
+  k. zend_fcall_info_cache.initialized
 
 2. Build system changes
   a. Unix build system changes
@@ -91,6 +92,9 @@ PHP 7.3 INTERNALS UPGRADE NOTES
      handler should return either an integer or float value in this case,
      whichever is more appropriate.
 
+  k. zend_fcall_info_cache.initialized is removed. zend_fcall_info_cache is
+     initialized if zend_fcall_info_cache.function_handler is set.
+
 ========================
 2. Build system changes
 ========================
index 4fea589dfc7b532a8f9658b38a829b454ba1c58a..12a302b6b9bb03fe0093764f7daec538175fbb26 100644 (file)
@@ -668,7 +668,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
 
                                if (check_null && Z_TYPE_P(arg) == IS_NULL) {
                                        fci->size = 0;
-                                       fcc->initialized = 0;
+                                       fcc->function_handler = 0;
                                        break;
                                }
 
@@ -2931,7 +2931,6 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
                zv = zend_hash_find(EG(function_table), lmname);
                if (EXPECTED(zv != NULL)) {
                        fcc->function_handler = Z_PTR_P(zv);
-                       fcc->initialized = 1;
                        if (lmname != Z_STR_P(callable)) {
                                ZSTR_ALLOCA_FREE(lmname, use_heap);
                        }
@@ -2946,7 +2945,6 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
                        zv = zend_hash_find(EG(function_table), lmname);
                        if (zv != NULL) {
                                fcc->function_handler = Z_PTR_P(zv);
-                               fcc->initialized = 1;
                                ZSTR_ALLOCA_FREE(lmname, use_heap);
                                return 1;
                        }
@@ -3178,7 +3176,7 @@ get_function_via_handler:
                fcc->called_scope = fcc->object->ce;
        }
        if (retval) {
-               fcc->initialized = 1;
+//???          fcc->initialized = 1;
        }
        return retval;
 }
@@ -3271,7 +3269,6 @@ static zend_bool zend_is_callable_impl(zval *callable, zend_object *object, uint
                *error = NULL;
        }
 
-       fcc->initialized = 0;
        fcc->calling_scope = NULL;
        fcc->called_scope = NULL;
        fcc->function_handler = NULL;
@@ -3380,7 +3377,6 @@ again:
                case IS_OBJECT:
                        if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
                                fcc->called_scope = fcc->calling_scope;
-                               fcc->initialized = 1;
                                return 1;
                        }
                        if (error) zend_spprintf(error, 0, "no array or string given");
index c05a527e6e37952e625ad0f52844ffc14058a150..84175821931c0be076b0f1b91585917c689ea105 100644 (file)
@@ -52,7 +52,6 @@ typedef struct _zend_fcall_info {
 } zend_fcall_info;
 
 typedef struct _zend_fcall_info_cache {
-       zend_bool initialized;
        zend_function *function_handler;
        zend_class_entry *calling_scope;
        zend_class_entry *called_scope;
@@ -1290,7 +1289,7 @@ static zend_always_inline int zend_parse_arg_func(zval *arg, zend_fcall_info *de
 {
        if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
                dest_fci->size = 0;
-               dest_fcc->initialized = 0;
+               dest_fcc->function_handler = NULL;
                *error = NULL;
        } else if (UNEXPECTED(zend_fcall_info_init(arg, 0, dest_fci, dest_fcc, NULL, error) != SUCCESS)) {
                return 0;
index 63cb4192bcdd8db4d140c7326d33dd26606d82d8..758c96bea4dac22eb4e95040b36a44d49f8b7275 100644 (file)
@@ -141,7 +141,6 @@ ZEND_METHOD(Closure, call)
        fci.params = my_params;
        fci.param_count = my_param_count;
        fci.object = fci_cache.object = newobj;
-       fci_cache.initialized = 1;
        fci_cache.called_scope = Z_OBJCE_P(newthis);
 
        if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_GENERATOR) {
@@ -247,7 +246,6 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
        fci.size = sizeof(zend_fcall_info);
        fci.retval = return_value;
 
-       fcc.initialized = 1;
        fcc.function_handler = (zend_function *) EX(func)->common.arg_info;
        fci.params = params;
        fci.param_count = 2;
index f2f9b550099bb89b0db3166ec17f4f1bb8a673e4..674354acf7855cbf74c2200c0ff09c58c9136c55 100644 (file)
@@ -675,7 +675,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
                EG(current_execute_data) = &dummy_execute_data;
        }
 
-       if (!fci_cache || !fci_cache->initialized) {
+       if (!fci_cache || !fci_cache->function_handler) {
                char *error = NULL;
 
                if (!fci_cache) {
@@ -792,7 +792,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
                EG(opline_before_exception) = current_opline_before_exception;
                if (call_via_handler) {
                        /* We must re-initialize function again */
-                       fci_cache->initialized = 0;
+                       fci_cache->function_handler = NULL;
                }
        } else if (func->type == ZEND_INTERNAL_FUNCTION) {
                int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
@@ -816,7 +816,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
 
                if (call_via_handler) {
                        /* We must re-initialize function again */
-                       fci_cache->initialized = 0;
+                       fci_cache->function_handler = NULL;
                }
        } else { /* ZEND_OVERLOADED_FUNCTION */
                ZVAL_NULL(fci->retval);
@@ -952,7 +952,6 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
        fcall_info.object = NULL;
        fcall_info.no_separation = 1;
 
-       fcall_cache.initialized = 1;
        fcall_cache.function_handler = EG(autoload_func);
        fcall_cache.calling_scope = NULL;
        fcall_cache.called_scope = NULL;
index 430e3b971520ec046c6abf2f84b022f19a81ecf5..33b811abed62a6016324fe52c6536e14999076e4 100644 (file)
@@ -63,7 +63,6 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
                zend_fcall_info_cache fcic;
                ZVAL_UNDEF(&fci.function_name); /* Unused */
 
-               fcic.initialized = 1;
                if (!obj_ce) {
                        obj_ce = object ? Z_OBJCE_P(object) : NULL;
                }
index 59f324c36efaef22b00f6b27c7e6c9f35c3eec4c..b5737da56be2a8b673cdfa7f831c21bf272c3294 100644 (file)
@@ -1303,7 +1303,6 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
                                }
                        }
 
-                       fcc.initialized = 1;
                        fcc.function_handler = ce->constructor;
                        fcc.calling_scope = zend_get_executed_scope();
                        fcc.called_scope = Z_OBJCE_P(return_value);
index f5b822bd73a99d1d62e40bdaf8310a9246ef5a93..9fbfc1ff578a9d55f49ed049a2502f34c18ed4f8 100644 (file)
@@ -442,7 +442,6 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
 
                zend_fcall_info_args(&fci, ctor_args);
 
-               fcc.initialized = 1;
                fcc.function_handler = dbstmt_ce->constructor;
                fcc.calling_scope = zend_get_executed_scope();
                fcc.called_scope = Z_OBJCE_P(object);
index f05cfce9c65131165a57d08267a7f3b9971d7e32..4805af76bfe48f29d469b236a68eb8fffe1983ae 100644 (file)
@@ -731,7 +731,6 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */
 
                zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args);
 
-               fcc->initialized = 1;
                fcc->function_handler = ce->constructor;
                fcc->calling_scope = zend_get_executed_scope();
                fcc->called_scope = ce;
index 06142f2bba53176f4ddd2f2236c4a659b03e30c6..ac153a68e29773299b7331986cf6c4fb50fe315a 100644 (file)
@@ -2840,7 +2840,6 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
                                }
                        }
 
-                       fcc.initialized = 1;
                        fcc.function_handler = ce->constructor;
                        fcc.calling_scope = zend_get_executed_scope();
                        fcc.called_scope = Z_OBJCE_P(return_value);
index 4444c6ef7bb6c66a41f0f1125712eee95531e884..4a5674710fbe24f3edb00e8a5a360c118e241c33 100644 (file)
@@ -1353,7 +1353,6 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
        fci.params = params;
        fci.no_separation = 1;
 
-       fcc.initialized = 1;
        fcc.function_handler = ce_ptr->constructor;
        fcc.calling_scope = ce_ptr;
        fcc.called_scope = Z_OBJCE(reflector);
@@ -1880,7 +1879,6 @@ ZEND_METHOD(reflection_function, invoke)
        fci.params = params;
        fci.no_separation = 1;
 
-       fcc.initialized = 1;
        fcc.function_handler = fptr;
        fcc.calling_scope = zend_get_executed_scope();
        fcc.called_scope = NULL;
@@ -1941,7 +1939,6 @@ ZEND_METHOD(reflection_function, invokeArgs)
        fci.params = params;
        fci.no_separation = 1;
 
-       fcc.initialized = 1;
        fcc.function_handler = fptr;
        fcc.calling_scope = zend_get_executed_scope();
        fcc.called_scope = NULL;
@@ -3208,7 +3205,6 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
        fci.params = params;
        fci.no_separation = 1;
 
-       fcc.initialized = 1;
        fcc.function_handler = mptr;
        fcc.calling_scope = obj_ce;
        fcc.called_scope = intern->ce;
@@ -4770,7 +4766,6 @@ ZEND_METHOD(reflection_class, newInstance)
                fci.params = params;
                fci.no_separation = 1;
 
-               fcc.initialized = 1;
                fcc.function_handler = constructor;
                fcc.calling_scope = zend_get_executed_scope();
                fcc.called_scope = Z_OBJCE_P(return_value);
@@ -4872,7 +4867,6 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
                fci.params = params;
                fci.no_separation = 1;
 
-               fcc.initialized = 1;
                fcc.function_handler = constructor;
                fcc.calling_scope = zend_get_executed_scope();
                fcc.called_scope = Z_OBJCE_P(return_value);
index 7abe14b12946309ed89f56dd224f15d689e3722a..9fbf772ffce224a4b1ef0068d1796a7022e757ec 100644 (file)
@@ -416,7 +416,6 @@ PHP_FUNCTION(spl_autoload_call)
                fci.no_separation = 1;
 
                ZVAL_UNDEF(&fci.function_name); /* Unused */
-               fcic.initialized = 1;
 
                zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &pos);
                while (zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &num_idx, &pos) == HASH_KEY_IS_STRING) {
index 4a012d74ea699117dc728c1d9a36d2ee95cefe75..be72c757464ef7ec10aead065cb893d7c60c92bb 100644 (file)
@@ -2082,7 +2082,6 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
        fci.no_separation = 1;
        ZVAL_STR(&fci.function_name, func_ptr->common.function_name);
 
-       fcic.initialized = 1;
        fcic.function_handler = func_ptr;
        fcic.calling_scope = NULL;
        fcic.called_scope = NULL;
index 6b50c6bd456bbba43e86bffb12f1f6b2893156f1..24e9fa965fdce0179f50d9ed29d68b3c59649c5c 100644 (file)
@@ -69,7 +69,6 @@ static inline void spl_instantiate_arg_n(zend_class_entry *pce, zval *retval, in
        fci.params = argv;
        fci.no_separation = 1;
 
-       fcc.initialized = 1;
        fcc.function_handler = func;
        fcc.calling_scope = zend_get_executed_scope();
        fcc.called_scope = pce;
index 893820cb9008938d5501c675a5b18960af9bfd7d..7c31e4533b50e2bb60aff3c49d1034fb2daef988 100644 (file)
@@ -311,7 +311,6 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php
                fci.params = NULL;
                fci.no_separation = 1;
 
-               fcc.initialized = 1;
                fcc.function_handler = uwrap->ce->constructor;
                fcc.calling_scope = zend_get_executed_scope();
                fcc.called_scope = Z_OBJCE_P(object);