With same behavior as not passing it.
#define Z_PARAM_FUNC(dest_fci, dest_fcc) \
Z_PARAM_FUNC_EX(dest_fci, dest_fcc, 0, 0)
+#define Z_PARAM_FUNC_OR_NULL(dest_fci, dest_fcc) \
+ Z_PARAM_FUNC_EX(dest_fci, dest_fcc, 1, 0)
+
/* old "h" */
#define Z_PARAM_ARRAY_HT_EX2(dest, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
zend_fcall_info_cache fcc;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
+ Z_PARAM_FUNC_OR_NULL(fci, fcc)
ZEND_PARSE_PARAMETERS_END();
_php_libxml_destroy_fci(&LIBXML(entity_loader).fci, &LIBXML(entity_loader).object);
zend_fcall_info_cache fcc;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
+ Z_PARAM_FUNC_OR_NULL(fci, fcc)
ZEND_PARSE_PARAMETERS_END();
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_ARRAY(array)
Z_PARAM_OPTIONAL
- Z_PARAM_FUNC(fci, fci_cache)
+ Z_PARAM_FUNC_OR_NULL(fci, fci_cache)
Z_PARAM_LONG(use_type)
ZEND_PARSE_PARAMETERS_END();
}
array_init(return_value);
- if (ZEND_NUM_ARGS() > 1) {
+ if (ZEND_FCI_INITIALIZED(fci)) {
have_callback = 1;
fci.no_separation = 0;
fci.retval = &retval;
uint32_t k, maxlen = 0;
ZEND_PARSE_PARAMETERS_START(2, -1)
- Z_PARAM_FUNC_EX(fci, fci_cache, 1, 0)
+ Z_PARAM_FUNC_OR_NULL(fci, fci_cache)
Z_PARAM_VARIADIC('+', arrays, n_arrays)
ZEND_PARSE_PARAMETERS_END();
/** @return mixed */
function array_reduce(array $arg, callable $callback, $initial = null) {}
-function array_filter(array $arg, callable $callback = UNKNOWN, int $use_keys = 0): array {}
+function array_filter(array $arg, ?callable $callback = null, int $use_keys = 0): array {}
function array_map(?callable $callback, array $arr1, array ...$arrays): array {}
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
- ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_keys, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
// with default arguments
var_dump( array_filter($input) );
+// same as with default arguments
+var_dump( array_filter($input, null) );
echo "Done"
?>
[4]=>
int(-1)
}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [4]=>
+ int(-1)
+}
Done