Skip to content

Commit c0214e4

Browse files
authored
Zend: remove zend_make_callable() function (php#20269)
The name of this function is confusing, it doesn't make a zval callable just normalizes strings to an array pair if the string references a static method. In general, to store a userland function it is encouraged to store the resolved FCC rather than the zval. Moreover, a sourcegraph search shows no usage of this API in external open source code.
1 parent 23674d9 commit c0214e4

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
3535
. The zval_dtor() alias of zval_ptr_dtor_nogc() has been removed.
3636
Call zval_ptr_dtor_nogc() directly instead.
3737
. The internal zend_copy_parameters_array() function is no longer exposed.
38+
. The zend_make_callable() function has been removed, if a callable zval
39+
needs to be obtained use the zend_get_callable_zval_from_fcc() function
40+
instead. If this was used to store a callable, then an FCC should be
41+
stored instead.
3842

3943
========================
4044
2. Build system changes

Zend/zend_API.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4232,24 +4232,6 @@ ZEND_API bool zend_is_callable(zval *callable, uint32_t check_flags, zend_string
42324232
}
42334233
/* }}} */
42344234

4235-
ZEND_API bool zend_make_callable(zval *callable, zend_string **callable_name) /* {{{ */
4236-
{
4237-
zend_fcall_info_cache fcc;
4238-
4239-
if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_SUPPRESS_DEPRECATIONS, callable_name, &fcc, NULL)) {
4240-
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
4241-
zval_ptr_dtor_str(callable);
4242-
array_init(callable);
4243-
add_next_index_str(callable, zend_string_copy(fcc.calling_scope->name));
4244-
add_next_index_str(callable, zend_string_copy(fcc.function_handler->common.function_name));
4245-
}
4246-
zend_release_fcall_info_cache(&fcc);
4247-
return 1;
4248-
}
4249-
return 0;
4250-
}
4251-
/* }}} */
4252-
42534235
ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error) /* {{{ */
42544236
{
42554237
if (!zend_is_callable_ex(callable, NULL, check_flags, callable_name, fcc, error)) {

Zend/zend_API.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ ZEND_API bool zend_is_callable_at_frame(
417417
uint32_t check_flags, zend_fcall_info_cache *fcc, char **error);
418418
ZEND_API bool zend_is_callable_ex(zval *callable, zend_object *object, uint32_t check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error);
419419
ZEND_API bool zend_is_callable(zval *callable, uint32_t check_flags, zend_string **callable_name);
420-
ZEND_API bool zend_make_callable(zval *callable, zend_string **callable_name);
421420
ZEND_API const char *zend_get_module_version(const char *module_name);
422421
ZEND_API zend_result zend_get_module_started(const char *module_name);
423422

0 commit comments

Comments
 (0)