Skip to content

Commit cff3172

Browse files
committed
Remove zend_fcall_info_call() API
The last parameter which is named zval *args, does NOT set the FCI params field. It is expected to be a PHP array which gets looped over to set the arguments which is also a zval pointer... Since PHP 8.0, the named_params field is a more appropriate way of doing this. Also remove zend_fcall_info_args_save() and zend_fcall_info_args_restore() as they were only used in the implementation of zend_fcall_info_call()
1 parent a85bb8b commit cff3172

File tree

3 files changed

+5
-54
lines changed

3 files changed

+5
-54
lines changed

UPGRADING.INTERNALS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ PHP 8.3 INTERNALS UPGRADE NOTES
1717
* zend_class_entry now possesses a default_object_handlers field, which
1818
provides a default object handler when create_object() is not overriding it.
1919

20+
* The following FCI APIs have been removed as they were confusing:
21+
- zend_fcall_info_call()
22+
- zend_fcall_info_args_save()
23+
- zend_fcall_info_args_restore()
24+
2025
========================
2126
2. Build system changes
2227
========================

Zend/zend_API.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4022,23 +4022,6 @@ ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem) /*
40224022
}
40234023
/* }}} */
40244024

4025-
ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, uint32_t *param_count, zval **params) /* {{{ */
4026-
{
4027-
*param_count = fci->param_count;
4028-
*params = fci->params;
4029-
fci->param_count = 0;
4030-
fci->params = NULL;
4031-
}
4032-
/* }}} */
4033-
4034-
ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_count, zval *params) /* {{{ */
4035-
{
4036-
zend_fcall_info_args_clear(fci, 1);
4037-
fci->param_count = param_count;
4038-
fci->params = params;
4039-
}
4040-
/* }}} */
4041-
40424025
ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args) /* {{{ */
40434026
{
40444027
zval *arg, *params;
@@ -4120,29 +4103,6 @@ ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...) /*
41204103
}
41214104
/* }}} */
41224105

4123-
ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval_ptr, zval *args) /* {{{ */
4124-
{
4125-
zval retval, *org_params = NULL;
4126-
uint32_t org_count = 0;
4127-
zend_result result;
4128-
4129-
fci->retval = retval_ptr ? retval_ptr : &retval;
4130-
if (args) {
4131-
zend_fcall_info_args_save(fci, &org_count, &org_params);
4132-
zend_fcall_info_args(fci, args);
4133-
}
4134-
result = zend_call_function(fci, fcc);
4135-
4136-
if (!retval_ptr && Z_TYPE(retval) != IS_UNDEF) {
4137-
zval_ptr_dtor(&retval);
4138-
}
4139-
if (args) {
4140-
zend_fcall_info_args_restore(fci, org_count, org_params);
4141-
}
4142-
return result;
4143-
}
4144-
/* }}} */
4145-
41464106
ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
41474107
{
41484108
zend_string *lname;

Zend/zend_API.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -690,15 +690,6 @@ ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags,
690690
*/
691691
ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem);
692692

693-
/** Save current arguments from zend_fcall_info *fci
694-
* params array will be set to NULL
695-
*/
696-
ZEND_API void zend_fcall_info_args_save(zend_fcall_info *fci, uint32_t *param_count, zval **params);
697-
698-
/** Free arguments connected with zend_fcall_info *fci and set back saved ones.
699-
*/
700-
ZEND_API void zend_fcall_info_args_restore(zend_fcall_info *fci, uint32_t param_count, zval *params);
701-
702693
/** Set or clear the arguments in the zend_call_info struct taking care of
703694
* refcount. If args is NULL and arguments are set then those are cleared.
704695
*/
@@ -723,11 +714,6 @@ ZEND_API void zend_fcall_info_argv(zend_fcall_info *fci, uint32_t argc, va_list
723714
*/
724715
ZEND_API void zend_fcall_info_argn(zend_fcall_info *fci, uint32_t argc, ...);
725716

726-
/** Call a function using information created by zend_fcall_info_init()/args().
727-
* If args is given then those replace the argument info in fci is temporarily.
728-
*/
729-
ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *fcc, zval *retval, zval *args);
730-
731717
/* Can only return FAILURE if EG(active) is false during late engine shutdown.
732718
* If the call or call setup throws, EG(exception) will be set and the retval
733719
* will be UNDEF. Otherwise, the retval will be a non-UNDEF value. */

0 commit comments

Comments
 (0)