From: Máté Kocsis Date: Sun, 17 Nov 2019 20:10:37 +0000 (+0100) Subject: Remove money_format() function X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=144b41ce8805e2afcdaa16e3dea350aa136f8849;p=php Remove money_format() function --- diff --git a/configure.ac b/configure.ac index 2af5c49809..f42e5112f9 100644 --- a/configure.ac +++ b/configure.ac @@ -607,7 +607,6 @@ statfs \ statvfs \ std_syslog \ strcasecmp \ -strfmon \ strnlen \ strptime \ strtok_r \ diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 91e71f4260..5c14ebf3c2 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -164,9 +164,6 @@ static const func_info_t func_infos[] = { F1("str_word_count", MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("str_split", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING), -#ifdef HAVE_STRFMON - F1("money_format", MAY_BE_FALSE | MAY_BE_STRING), -#endif FN("substr", MAY_BE_FALSE | MAY_BE_STRING), FN("substr_replace", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING), F1("quotemeta", MAY_BE_STRING), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d33a06a9d9..23bf7daaf6 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -932,10 +932,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(utf8_decode, arginfo_utf8_decode) PHP_FE(strcoll, arginfo_strcoll) -#ifdef HAVE_STRFMON - PHP_DEP_FE(money_format, arginfo_money_format) -#endif - PHP_FE(substr, arginfo_substr) PHP_FE(substr_replace, arginfo_substr_replace) PHP_FE(quotemeta, arginfo_quotemeta) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 8bad7b97de..98771c62f7 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -667,10 +667,6 @@ function str_shuffle(string $str): string {} function str_word_count(string $str, int $format = 0, string $charlist = UNKNOWN): array|int {} -#ifdef HAVE_STRFMON -function money_format(string $format, float $value): string|false {} -#endif - function str_split(string $str, int $split_length = 1): array {} function strpbrk(string $haystack, string $char_list): string|false {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 7d44774e87..3bc370734b 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1052,13 +1052,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_word_count, 0, 1, MAY_BE_ARR ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0) ZEND_END_ARG_INFO() -#if defined(HAVE_STRFMON) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_money_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_split, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0) diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index bdeb87b912..6d66e0f1fe 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -89,9 +89,6 @@ PHP_FUNCTION(substr_compare); PHP_FUNCTION(utf8_encode); PHP_FUNCTION(utf8_decode); PHP_FUNCTION(strcoll); -#if HAVE_STRFMON -PHP_FUNCTION(money_format); -#endif #if defined(ZTS) PHP_MINIT_FUNCTION(localeconv); diff --git a/ext/standard/string.c b/ext/standard/string.c index 16f3f0d88e..5ee935ac9e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5925,58 +5925,6 @@ PHP_FUNCTION(str_word_count) /* }}} */ -#if HAVE_STRFMON -/* {{{ proto string|false money_format(string format , float value) - Convert monetary value(s) to string */ -PHP_FUNCTION(money_format) -{ - size_t format_len = 0; - char *format, *p, *e; - double value; - zend_bool check = 0; - zend_string *str; - ssize_t res_len; - - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STRING(format, format_len) - Z_PARAM_DOUBLE(value) - ZEND_PARSE_PARAMETERS_END(); - - p = format; - e = p + format_len; - while ((p = memchr(p, '%', (e - p)))) { - if (*(p + 1) == '%') { - p += 2; - } else if (!check) { - check = 1; - p++; - } else { - php_error_docref(NULL, E_WARNING, "Only a single %%i or %%n token can be used"); - RETURN_FALSE; - } - } - - str = zend_string_safe_alloc(format_len, 1, 1024, 0); - if ((res_len = strfmon(ZSTR_VAL(str), ZSTR_LEN(str), format, value)) < 0) { - zend_string_efree(str); - RETURN_FALSE; - } -#ifdef _AIX - /* - On AIX strfmon seems to include the terminating \0 in the length returned by strfmon, - despite the documentation indicating it is not included. - */ - ZSTR_LEN(str) = strlen(ZSTR_VAL(str)); -#else - ZSTR_LEN(str) = (size_t)res_len; -#endif - ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0'; - - RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0)); -} -/* }}} */ -#endif - /* {{{ proto array str_split(string str [, int split_length]) Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */ PHP_FUNCTION(str_split) diff --git a/ext/standard/tests/strings/money_format_basic1.phpt b/ext/standard/tests/strings/money_format_basic1.phpt deleted file mode 100644 index abf7bcf508..0000000000 --- a/ext/standard/tests/strings/money_format_basic1.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -Test money_format() function : basic functionality using national currency symbols ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing money_format() : basic functionality*** -Format values with 14 positions, 8 digits to left, 2 to right using national format - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again but with ( for negative values - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format with 0 for padding character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again with * for padding character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again but disable grouping character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again suppress currency symbol - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt deleted file mode 100644 index b462f1b9db..0000000000 --- a/ext/standard/tests/strings/money_format_error.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test money_format() function : error conditions ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing money_format() : error conditions *** - --- Testing money_format() function with more than one token -- - -Deprecated: Function money_format() is deprecated in %s on line %d - -Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d -bool(false) diff --git a/ext/standard/tests/strings/moneyformat.phpt b/ext/standard/tests/strings/moneyformat.phpt deleted file mode 100644 index 9c10148f7d..0000000000 --- a/ext/standard/tests/strings/moneyformat.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -money_format test ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function money_format() is deprecated in %s on line %d -string(7) "X$3.14Y"