]> granicus.if.org Git - php/commitdiff
Remove money_format() function
authorMáté Kocsis <kocsismate@woohoolabs.com>
Sun, 17 Nov 2019 20:10:37 +0000 (21:10 +0100)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 5 Dec 2019 12:15:54 +0000 (13:15 +0100)
configure.ac
ext/opcache/Optimizer/zend_func_info.c
ext/standard/basic_functions.c
ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h
ext/standard/php_string.h
ext/standard/string.c
ext/standard/tests/strings/money_format_basic1.phpt [deleted file]
ext/standard/tests/strings/money_format_error.phpt [deleted file]
ext/standard/tests/strings/moneyformat.phpt [deleted file]

index 2af5c49809083be8b23edbfaefb6e22e77fc8276..f42e5112f975b02820e1157871546e08b661967d 100644 (file)
@@ -607,7 +607,6 @@ statfs \
 statvfs \
 std_syslog \
 strcasecmp \
-strfmon \
 strnlen \
 strptime \
 strtok_r \
index 91e71f42600a6897ffd16346c0c70a3f2da77278..5c14ebf3c254a3249f4b340562c0384979ff21a3 100644 (file)
@@ -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),
index d33a06a9d97520ac02bcf16791538fdc6ff29ea1..23bf7daaf6c029b75012a39bc6561d22c75e97dc 100755 (executable)
@@ -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)
index 8bad7b97deadf218fc443d85ba2c4f756449f86f..98771c62f7bba0feee341e0bc3047ee740ef1e56 100755 (executable)
@@ -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 {}
index 7d44774e87277db69f67127bc65f94b31b1c73f2..3bc370734bbc6225c6339bca58c9b63a2463669d 100755 (executable)
@@ -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)
index bdeb87b9123a7f1ca09201103f56fb1c46e0cb59..6d66e0f1fe9781234d900f32ec4f710f591f4cdf 100644 (file)
@@ -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);
index 16f3f0d88e2637c1352dbb2e323aba47926969a2..5ee935ac9e0394227c6e24fbe9f12b85f2fba357 100644 (file)
@@ -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 (file)
index abf7bcf..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
---TEST--
-Test money_format() function : basic functionality using national currency symbols
---SKIPIF--
-<?php
-       if (!function_exists('money_format')) {
-               die("SKIP money_format - not supported\n");
-       }
-?>
---FILE--
-<?php
-/* Prototype  : string money_format  ( string $format  , float $number  )
- * Description: Formats a number as a currency string
- * Source code: ext/standard/string.c
-*/
-
-// ===========================================================================================
-// = We do not test for exact return-values, as those might be different between OS-versions =
-// ===========================================================================================
-
-echo "*** Testing money_format() : basic functionality***\n";
-
-$value = 1234.5678;
-$negative_value = -1234.5678;
-
-// Format with 14 positions of width, 8 digits of
-// left precision, 2 of right precision using national
-// format for en_US
-echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
-echo gettype(money_format('%14#8.2n', $value))."\n";
-echo gettype(money_format('%14#8.2n', $negative_value))."\n";
-
-// Same again but use '(' for negative values
-echo "Format again but with ( for negative values\n";
-echo gettype(money_format('%(14#8.2n', $value))."\n";
-echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
-
-// Same again but use a '0' for padding character
-echo "Format with 0 for padding character\n";
-echo gettype(money_format('%=014#8.2n', $value))."\n";
-echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
-
-// Same again but use a '*' for padding character
-echo "Format again with * for padding character\n";
-echo gettype(money_format('%=*14#8.2n', $value))."\n";
-echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
-
-// Same again but disable grouping character
-echo "Format again but disable grouping character\n";
-echo gettype(money_format('%=*^14#8.2n', $value))."\n";
-echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
-
-// Same again but suppress currency symbol
-echo "Format again suppress currency symbol\n";
-echo gettype(money_format('%=*!14#8.2n', $value))."\n";
-echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
-
-?>
---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 (file)
index b462f1b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test money_format() function : error conditions
---SKIPIF--
-<?php
-       if (!function_exists('money_format')) {
-               die("SKIP money_format - not supported\n");
-       }
-?>
---FILE--
-<?php
-/* Prototype  : string money_format  ( string $format  , float $number  )
- * Description: Formats a number as a currency string
- * Source code: ext/standard/string.c
-*/
-
-// ===========================================================================================
-// = We do not test for exact return-values, as those might be different between OS-versions =
-// ===========================================================================================
-
-$string = '%14#8.2n';
-$value = 1234.56;
-$extra_arg = 10;
-
-echo "*** Testing money_format() : error conditions ***\n";
-
-echo "\n-- Testing money_format() function with more than one token --\n";
-var_dump( money_format($string . $string, $value) );
-?>
---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 (file)
index 9c10148..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-money_format test
---SKIPIF--
-<?php
-       if (!function_exists('money_format')) {
-               die("SKIP money_format - not supported\n");
-       }
-
-if (setlocale(LC_MONETARY, 'en_US') === false) {
-       die('skip en_US locale not available');
-}
-?>
---FILE--
-<?php
-setlocale(LC_MONETARY, 'en_US');
-var_dump( money_format("X%nY", 3.1415));
-?>
---EXPECTF--
-Deprecated: Function money_format() is deprecated in %s on line %d
-string(7) "X$3.14Y"