]> granicus.if.org Git - php/commitdiff
Remove no_separation flag
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 7 Jul 2020 07:30:24 +0000 (09:30 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 7 Jul 2020 07:30:24 +0000 (09:30 +0200)
27 files changed:
UPGRADING.INTERNALS
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_closures.c
Zend/zend_exceptions.c
Zend/zend_execute_API.c
ext/curl/interface.c
ext/dom/xpath.c
ext/ffi/ffi.c
ext/intl/converter/converter.c
ext/libxml/libxml.c
ext/mysqli/mysqli.c
ext/pcre/php_pcre.c
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
ext/pgsql/pgsql.c
ext/reflection/php_reflection.c
ext/soap/soap.c
ext/spl/spl_directory.c
ext/spl/spl_engine.h
ext/spl/spl_iterators.c
ext/sqlite3/sqlite3.c
ext/standard/array.c
ext/xml/xml.c
ext/xsl/xsltprocessor.c
main/streams/userspace.c
sapi/phpdbg/phpdbg_prompt.c

index efa8fdd7542a79c029ca4d465f0849d3272e5234..a9a6553466c3e797beff5c33fff3dc02782b61a7 100644 (file)
@@ -19,6 +19,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
   p. ARG_COUNT() macro removed
   q. GC_COLLECTABLE flag
   r. Cannot implement Traversable only
+  s. zend_fcall_info no_separation flag removed
 
 2. Build system changes
   a. Abstract
@@ -135,6 +136,11 @@ PHP 8.0 INTERNALS UPGRADE NOTES
              zend_create_internal_iterator_zval(return_value, ZEND_THIS);
          }
 
+   s. The zend_fcall_info no_separation flag has been removed, and separation is
+      never allowed. If you wish to pass (or allow passing) arguments by
+      reference, explicitly create those arguments as references using
+      ZEND_MAKE_REF.
+
 ========================
 2. Build system changes
 ========================
index 4aa0103ae50621bac58e9b99fca294d177e22b3a..8fd319ea2e82f4a23327a5a34171f7c944ed3997 100644 (file)
@@ -3342,7 +3342,6 @@ ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fca
        fci->retval = NULL;
        fci->param_count = 0;
        fci->params = NULL;
-       fci->no_separation = 1;
 
        return SUCCESS;
 }
index 1adfbacb058f7cf07b421718b4b3cdea24bd7573..0d019711cbb572e0d13464571d088205c928a697 100644 (file)
@@ -46,7 +46,6 @@ typedef struct _zend_fcall_info {
        zval *retval;
        zval *params;
        zend_object *object;
-       zend_bool no_separation;
        uint32_t param_count;
 } zend_fcall_info;
 
@@ -498,12 +497,10 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zv
 #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value)
 
 
-ZEND_API int _call_user_function_ex(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation);
+ZEND_API int _call_user_function_ex(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]);
 
 #define call_user_function(_unused, object, function_name, retval_ptr, param_count, params) \
-       _call_user_function_ex(object, function_name, retval_ptr, param_count, params, 1)
-#define call_user_function_ex(_unused, object, function_name, retval_ptr, param_count, params, no_separation, _unused2) \
-       _call_user_function_ex(object, function_name, retval_ptr, param_count, params, no_separation)
+       _call_user_function_ex(object, function_name, retval_ptr, param_count, params)
 
 ZEND_API extern const zend_fcall_info empty_fcall_info;
 ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
index 7331188228c790555ad89a179fd129128084d6ef..a0d6450c5eae0e44f35cd2eecd00322e2cdf9aae 100644 (file)
@@ -167,7 +167,6 @@ ZEND_METHOD(Closure, call)
        fci.size = sizeof(fci);
        ZVAL_OBJ(&fci.function_name, &closure->std);
        fci.retval = &closure_result;
-       fci.no_separation = 1;
 
        if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(closure_result) != IS_UNDEF) {
                if (Z_ISREF(closure_result)) {
index 4954a1bd5b3deeb1a77610ac7d4a270050acc1da..0103422f942dab9fcad788f53c41533f14c7d96a 100644 (file)
@@ -659,7 +659,6 @@ ZEND_METHOD(Exception, __toString)
                fci.retval = &trace;
                fci.param_count = 0;
                fci.params = NULL;
-               fci.no_separation = 1;
 
                zend_call_function(&fci, NULL);
 
index ab5766af27b199006e94f82f5302fe61d22eb3d7..6a2b82f96d09142000a42dc13032658faeb8a97a 100644 (file)
@@ -619,7 +619,7 @@ ZEND_API int zval_update_constant(zval *pp) /* {{{ */
 }
 /* }}} */
 
-int _call_user_function_ex(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation) /* {{{ */
+int _call_user_function_ex(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]) /* {{{ */
 {
        zend_fcall_info fci;
 
@@ -629,7 +629,6 @@ int _call_user_function_ex(zval *object, zval *function_name, zval *retval_ptr,
        fci.retval = retval_ptr;
        fci.param_count = param_count;
        fci.params = params;
-       fci.no_separation = (zend_bool) no_separation;
 
        return zend_call_function(&fci, NULL);
 }
@@ -737,10 +736,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
 
                if (ARG_SHOULD_BE_SENT_BY_REF(func, i + 1)) {
                        if (UNEXPECTED(!Z_ISREF_P(arg))) {
-                               if (!fci->no_separation) {
-                                       /* Separation is enabled -- create a ref */
-                                       ZVAL_NEW_REF(arg, arg);
-                               } else if (!ARG_MAY_BE_SENT_BY_REF(func, i + 1)) {
+                               if (!ARG_MAY_BE_SENT_BY_REF(func, i + 1)) {
                                        /* By-value send is not allowed -- emit a warning,
                                         * but still perform the call with a by-value send. */
                                        zend_param_must_be_ref(func, i + 1);
@@ -866,7 +862,6 @@ ZEND_API void zend_call_known_function(
        fci.retval = retval_ptr ? retval_ptr : &retval;
        fci.param_count = param_count;
        fci.params = params;
-       fci.no_separation = 1;
        ZVAL_UNDEF(&fci.function_name); /* Unused */
 
        fcic.function_handler = fn;
index 6f5a79c42f255af6265e3b4a7ecfa53266ede5dc..e129c7708d4bf951e390e91d468069badc3d640a 100644 (file)
@@ -1385,7 +1385,6 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
                        fci.retval = &retval;
                        fci.param_count = 2;
                        fci.params = argv;
-                       fci.no_separation = 1;
 
                        ch->in_callback = 1;
                        error = zend_call_function(&fci, &t->fci_cache);
@@ -1432,7 +1431,6 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
                        fci.retval = &retval;
                        fci.param_count = 3;
                        fci.params = argv;
-                       fci.no_separation = 1;
 
                        ch->in_callback = 1;
                        error = zend_call_function(&fci, &t->fci_cache);
@@ -1485,7 +1483,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
                        fci.retval = &retval;
                        fci.param_count = 5;
                        fci.params = argv;
-                       fci.no_separation = 1;
 
                        ch->in_callback = 1;
                        error = zend_call_function(&fci, &t->fci_cache);
@@ -1541,7 +1538,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
                        fci.retval = &retval;
                        fci.param_count = 3;
                        fci.params = argv;
-                       fci.no_separation = 1;
 
                        ch->in_callback = 1;
                        error = zend_call_function(&fci, &t->fci_cache);
@@ -1603,7 +1599,6 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
                        fci.retval = &retval;
                        fci.param_count = 2;
                        fci.params = argv;
-                       fci.no_separation = 1;
 
                        ch->in_callback = 1;
                        error = zend_call_function(&fci, &t->fci_cache);
index 83a0581ce4b199c75885fc832f02824718aaa2dc..b3181972cadc043b635e4cfec1e831da49aa9ed4 100644 (file)
@@ -151,7 +151,6 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
 
        fci.object = NULL;
        fci.retval = &retval;
-       fci.no_separation = 1;
 
        if (!zend_make_callable(&fci.function_name, &callable)) {
                php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable));
index 60e4679f2983c69a8503ff90e32b9b1c7f1bc159..22a11f692d692ca3bd7e7bd67b8ea093333103a5 100644 (file)
@@ -857,7 +857,6 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
        fci.retval = &retval;
        fci.params = do_alloca(sizeof(zval) *callback_data->arg_count, use_heap);
        fci.object = NULL;
-       fci.no_separation = 1;
        fci.param_count = callback_data->arg_count;
 
        if (callback_data->type->func.args) {
index efb4df279e03bddad452d95f5648201fe3699a9d..5151daaa3637903b17b7dad8437c47bf37bdb8ce 100644 (file)
@@ -229,7 +229,6 @@ static void php_converter_to_u_callback(const void *context,
        objval->to_cb.param_count    = 4;
        objval->to_cb.params = zargs;
        objval->to_cb.retval = &retval;
-       objval->to_cb.no_separation  = 1;
        if (zend_call_function(&(objval->to_cb), &(objval->to_cache)) == FAILURE) {
                /* Unlikely */
                php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR, "Unexpected failure calling toUCallback()");
@@ -312,7 +311,6 @@ static void php_converter_from_u_callback(const void *context,
        objval->from_cb.param_count = 4;
        objval->from_cb.params = zargs;
        objval->from_cb.retval = &retval;
-       objval->from_cb.no_separation  = 1;
        if (zend_call_function(&(objval->from_cb), &(objval->from_cache)) == FAILURE) {
                /* Unlikely */
                php_converter_throw_failure(objval, U_INTERNAL_PROGRAM_ERROR, "Unexpected failure calling fromUCallback()");
index 98402e2e49ef868807556a62652f86c55d8f3b03..5fd571d57b9e9a5f95326e76c60b4383f495d316 100644 (file)
@@ -566,7 +566,6 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
        fci->retval     = &retval;
        fci->params     = params;
        fci->param_count = sizeof(params)/sizeof(*params);
-       fci->no_separation      = 1;
 
        status = zend_call_function(fci, &LIBXML(entity_loader).fcc);
        if (status != SUCCESS || Z_ISUNDEF(retval)) {
index f832352edb46b66d4c30be997c0ff78465ee98df..0d1c34d7fc59919b1709ad8301ae0aee1b6b0b3c 100644 (file)
@@ -1227,7 +1227,6 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
                        fci.retval = &retval;
                        fci.params = NULL;
                        fci.param_count = 0;
-                       fci.no_separation = 1;
 
                        if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
                                if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) {
index 7aaaf3f695d1776c2eaf5bc609101af0bd40fcd5..16ec75d02b2d7dde0eee6f78425fe18b86b50068 100644 (file)
@@ -1529,7 +1529,6 @@ static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cach
        fci->retval = &retval;
        fci->param_count = 1;
        fci->params = &arg;
-       fci->no_separation = 1;
 
        if (zend_call_function(fci, fcc) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
                if (EXPECTED(Z_TYPE(retval) == IS_STRING)) {
index b80bdf60d4563af73da89f4f20f0d13c8730072e..9c6c635cce5077c1d7ae30455aba3342db6849d7 100644 (file)
@@ -437,7 +437,6 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
                fci.retval = &retval;
                fci.param_count = 0;
                fci.params = NULL;
-               fci.no_separation = 1;
 
                zend_fcall_info_args(&fci, ctor_args);
 
index 5a49491e32cb2c6b3d4a60cb770954d8f00a1491..9b13ad8887431d17dcf737431801d322f6d639ff 100644 (file)
@@ -655,7 +655,6 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */
                fci->retval = &stmt->fetch.cls.retval;
                fci->param_count = 0;
                fci->params = NULL;
-               fci->no_separation = 1;
 
                zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args);
 
index 442d09af044328f3dbbcfd914138d26ad6fb70d7..5b3dc9a80cd7eb0cb9058947b009fbffc569ea02 100644 (file)
@@ -2584,7 +2584,6 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
                        fci.retval = &retval;
                        fci.params = NULL;
                        fci.param_count = 0;
-                       fci.no_separation = 1;
 
                        if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
                                if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) {
index 4897fbb82289f8c32076ce79db4546daad5a6b3e..9b8c34e4ddd64d9bf94a2ba90cd5e46a592c350a 100644 (file)
@@ -1816,7 +1816,6 @@ ZEND_METHOD(ReflectionFunction, invoke)
        fci.retval = &retval;
        fci.param_count = num_args;
        fci.params = params;
-       fci.no_separation = 1;
 
        fcc.function_handler = fptr;
        fcc.called_scope = NULL;
@@ -1878,7 +1877,6 @@ ZEND_METHOD(ReflectionFunction, invokeArgs)
        fci.retval = &retval;
        fci.param_count = argc;
        fci.params = params;
-       fci.no_separation = 1;
 
        fcc.function_handler = fptr;
        fcc.called_scope = NULL;
@@ -3206,7 +3204,6 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
        fci.retval = &retval;
        fci.param_count = argc;
        fci.params = params;
-       fci.no_separation = 1;
 
        fcc.function_handler = mptr;
        fcc.called_scope = intern->ce;
index a18f085c07d2e520b81e60ba40f850b6151a6eb6..4a5742fdebacaf7afb81a1e891ce27104ceecca5 100644 (file)
@@ -654,7 +654,6 @@ PHP_METHOD(SoapFault, __toString)
        fci.retval = &trace;
        fci.param_count = 0;
        fci.params = NULL;
-       fci.no_separation = 1;
 
        zend_call_function(&fci, NULL);
 
index 6053d75ac89a898e7a3d78a46fcb8d414ecf0410..b53c2b8722510551f0f800347f2c93eec6c98a2b 100644 (file)
@@ -1904,7 +1904,6 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
        fci.retval = return_value;
        fci.param_count = num_args;
        fci.params = params;
-       fci.no_separation = 1;
        ZVAL_STR(&fci.function_name, func_ptr->common.function_name);
 
        fcic.function_handler = func_ptr;
index 44c6867e034ec65ca39e545ab4484b1add99a3d1..b7fbb69f5985e85fa22108fee4e3a138a95bd3d6 100644 (file)
@@ -63,7 +63,6 @@ static inline void spl_instantiate_arg_n(zend_class_entry *pce, zval *retval, in
        fci.retval = &dummy;
        fci.param_count = argc;
        fci.params = argv;
-       fci.no_separation = 1;
 
        fcc.function_handler = func;
        fcc.called_scope = pce;
index 9e4ed5036f98b5631e3cc1acad4e17a914d08b7e..d7dac8ac686fb92303c77bee2abcf1e35b8c3920 100644 (file)
@@ -1785,7 +1785,6 @@ PHP_METHOD(CallbackFilterIterator, accept)
        fci->retval = return_value;
        fci->param_count = 3;
        fci->params = params;
-       fci->no_separation = 1;
 
        if (zend_call_function(fci, fcc) != SUCCESS || Z_ISUNDEF_P(return_value)) {
                RETURN_FALSE;
index 58696c01bb32d530124e8d0dcb457b7e8ef49846..af7304c5f5c35981fba1ef5a9875080f70fce55a 100644 (file)
@@ -2146,7 +2146,6 @@ static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, c
        fci->retval = &retval;
        fci->param_count = 5;
        fci->params = argv;
-       fci->no_separation = 1;
 
        int authreturn = SQLITE_DENY;
 
index 3eb06bd3c430545a7054d94be45d5bbbd1ba327d..ab9d020e944b62b7564f9be2a048a2b4838fc072 100644 (file)
@@ -921,7 +921,6 @@ static inline int php_array_user_compare_unstable(Bucket *f, Bucket *s) /* {{{ *
        BG(user_compare_fci).param_count = 2;
        BG(user_compare_fci).params = args;
        BG(user_compare_fci).retval = &retval;
-       BG(user_compare_fci).no_separation = 1;
        call_failed = zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE || Z_TYPE(retval) == IS_UNDEF;
        zval_ptr_dtor(&args[1]);
        zval_ptr_dtor(&args[0]);
@@ -1063,7 +1062,6 @@ static inline int php_array_user_key_compare_unstable(Bucket *f, Bucket *s) /* {
        BG(user_compare_fci).param_count = 2;
        BG(user_compare_fci).params = args;
        BG(user_compare_fci).retval = &retval;
-       BG(user_compare_fci).no_separation = 1;
        call_failed = zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE || Z_TYPE(retval) == IS_UNDEF;
        zval_ptr_dtor(&args[1]);
        zval_ptr_dtor(&args[0]);
@@ -1374,7 +1372,6 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */
        BG(array_walk_fci).retval = &retval;
        BG(array_walk_fci).param_count = userdata ? 3 : 2;
        BG(array_walk_fci).params = args;
-       BG(array_walk_fci).no_separation = 1;
 
        zend_hash_internal_pointer_reset_ex(target_hash, &pos);
        ht_iter = zend_hash_iterator_add(target_hash, pos);
@@ -4546,7 +4543,6 @@ static int zval_user_compare(zval *a, zval *b) /* {{{ */
        BG(user_compare_fci).param_count = 2;
        BG(user_compare_fci).params = args;
        BG(user_compare_fci).retval = &retval;
-       BG(user_compare_fci).no_separation = 1;
 
        if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache)) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
                zend_long ret = zval_get_long(&retval);
@@ -5906,7 +5902,6 @@ PHP_FUNCTION(array_reduce)
 
        fci.retval = &retval;
        fci.param_count = 2;
-       fci.no_separation = 1;
 
        ZEND_HASH_FOREACH_VAL(htbl, operand) {
                ZVAL_COPY_VALUE(&args[0], return_value);
@@ -5959,7 +5954,6 @@ PHP_FUNCTION(array_filter)
 
        if (ZEND_FCI_INITIALIZED(fci)) {
                have_callback = 1;
-               fci.no_separation = 1;
                fci.retval = &retval;
                if (use_type == ARRAY_FILTER_USE_BOTH) {
                        fci.param_count = 2;
@@ -6062,7 +6056,6 @@ PHP_FUNCTION(array_map)
                        fci.retval = &result;
                        fci.param_count = 1;
                        fci.params = &arg;
-                       fci.no_separation = 1;
 
                        ZVAL_COPY(&arg, zv);
                        ret = zend_call_function(&fci, &fci_cache);
@@ -6151,7 +6144,6 @@ PHP_FUNCTION(array_map)
                                fci.retval = &result;
                                fci.param_count = n_arrays;
                                fci.params = params;
-                               fci.no_separation = 1;
 
                                if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
                                        efree(array_pos);
index 60bdfb426144ea20805ca039139f85a210139032..476d77444c698ea0901d4d175fc775f8d529c5ad 100644 (file)
@@ -464,7 +464,6 @@ static void xml_call_handler(xml_parser *parser, zval *handler, zend_function *f
                fci.retval = retval;
                fci.param_count = argc;
                fci.params = argv;
-               fci.no_separation = 1;
 
                result = zend_call_function(&fci, NULL);
                if (result == FAILURE) {
index b63814e236c5177078f8b1dde6d07bd214e6787c..0dc909d9d087d0623cbc0864262590cf63614d44 100644 (file)
@@ -245,7 +245,6 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
        ZVAL_COPY_VALUE(&fci.function_name, &handler);
        fci.object = NULL;
        fci.retval = &retval;
-       fci.no_separation = 1;
        if (!zend_make_callable(&handler, &callable)) {
                if (!EG(exception)) {
                        php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable));
index ae00187483a2b4ef3db7fe9edfd52a3057ce95f9..ee74d49bde9c4b17634dc8da141ecd47b89341c5 100644 (file)
@@ -308,7 +308,6 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php
                fci.retval = &retval;
                fci.param_count = 0;
                fci.params = NULL;
-               fci.no_separation = 1;
 
                fcc.function_handler = uwrap->ce->constructor;
                fcc.called_scope = Z_OBJCE_P(object);
index f6b5ef41e5315520af3f9ee9004c0c8a0fe0064c..2c58ffc3fb1ae1e96fa9541570e81a94bb9cc9c1 100644 (file)
@@ -122,7 +122,6 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
                        //???fci.symbol_table = zend_rebuild_symbol_table();
                        fci.object = NULL;
                        fci.retval = &fretval;
-                       fci.no_separation = 1;
 
                        if (name->next) {
                                zval params;