From 58e171538ce44a74b071004c8b38e4a4230e97bb Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Fri, 15 Aug 2025 12:46:44 -0300 Subject: [PATCH 1/3] Adding split as an alias for explode --- ext/standard/basic_functions_arginfo.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index ba9d1710137cc..17477f5a68c68 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -854,6 +854,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_explode, 0, 2, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "PHP_INT_MAX") ZEND_END_ARG_INFO() +#define arginfo_split arginfo_explode + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, separator, MAY_BE_STRING|MAY_BE_ARRAY, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, array, IS_ARRAY, 1, "null") @@ -3127,6 +3129,7 @@ static const zend_function_entry ext_functions[] = { ZEND_RAW_FENTRY("ltrim", zif_ltrim, arginfo_ltrim, ZEND_ACC_COMPILE_TIME_EVAL, NULL, NULL) ZEND_RAW_FENTRY("wordwrap", zif_wordwrap, arginfo_wordwrap, ZEND_ACC_COMPILE_TIME_EVAL, NULL, NULL) ZEND_RAW_FENTRY("explode", zif_explode, arginfo_explode, ZEND_ACC_COMPILE_TIME_EVAL, NULL, NULL) + ZEND_RAW_FENTRY("split", zif_explode, arginfo_split, 0, NULL, NULL) ZEND_RAW_FENTRY("implode", zif_implode, arginfo_implode, ZEND_ACC_COMPILE_TIME_EVAL, frameless_function_infos_implode, NULL) ZEND_RAW_FENTRY("join", zif_implode, arginfo_join, 0, NULL, NULL) ZEND_FE(strtok, arginfo_strtok) From ccc2a16bd950ea81cf67b640c8fda47439017f3a Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Fri, 15 Aug 2025 13:43:38 -0300 Subject: [PATCH 2/3] Changing .stub.php file and running ./build/gen_stub.php --- ext/standard/basic_functions.stub.php | 3 +++ ext/standard/basic_functions_arginfo.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 541415a5ab918..10f9ca66f9feb 100644 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -2351,6 +2351,9 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c */ function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {} +/** @alias explode */ +function split(string $separator, string $string, int $limit = PHP_INT_MAX): array {} + /** * @compile-time-eval * @frameless-function {"arity": 1} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 17477f5a68c68..9fdec2086aec2 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: deb4ea96dd130d8a0174678095c30a61e118bd60 */ + * Stub hash: b451d298e78813d84a5cdf8f6aeb1aef52828083 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) From 40b0c2503d5a0966c7930a0ddd2d3496844bb7db Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Fri, 15 Aug 2025 15:24:47 -0300 Subject: [PATCH 3/3] Adding @return to split --- ext/standard/basic_functions.stub.php | 5 ++++- ext/standard/basic_functions_arginfo.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 10f9ca66f9feb..063e4dc66828e 100644 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -2351,7 +2351,10 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c */ function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {} -/** @alias explode */ +/** + * @return array + * @alias explode + */ function split(string $separator, string $string, int $limit = PHP_INT_MAX): array {} /** diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 9fdec2086aec2..8ce9b317b43f3 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b451d298e78813d84a5cdf8f6aeb1aef52828083 */ + * Stub hash: 37e777cecf17f3ad016c038edfc8c4590226e62e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)