From cd58faa031acfafb90eb6992a33f198c4e56c9ea Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Fri, 22 Sep 2006 18:24:12 +0000 Subject: [PATCH] Bring localeconv(), money_format(), and nl_langinfo() to standards. Add E_STRICT notices about them being deprecated in Unicode mode. --- ext/standard/string.c | 34 +++++++++++++++++++++++----------- unicode-progress.txt | 12 +++--------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 84252705b3..ff12fa2f96 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -472,19 +472,22 @@ PHP_MINIT_FUNCTION(nl_langinfo) } /* }}} */ -/* {{{ proto string nl_langinfo(int item) +/* {{{ proto string nl_langinfo(int item) U Query language and locale information */ PHP_FUNCTION(nl_langinfo) { - zval **item; + long item; char *value; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) { + return; } - convert_to_long_ex(item); - value = nl_langinfo(Z_LVAL_PP(item)); + if (UG(unicode)) { + php_error_docref(NULL TSRMLS_DC, E_STRICT, "deprecated in Unicode mode, please use ICU locale functions"); + } + + value = nl_langinfo(item); if (value == NULL) { RETURN_FALSE; } else { @@ -5514,6 +5517,11 @@ PHP_FUNCTION(setlocale) efree(args); WRONG_PARAM_COUNT; } + + if (UG(unicode)) { + php_error_docref(NULL TSRMLS_DC, E_STRICT, "deprecated in Unicode mode, please use ICU locale functions"); + } + #ifdef HAVE_SETLOCALE pcategory = args[0]; if (Z_TYPE_PP(pcategory) == IS_LONG) { @@ -6435,7 +6443,7 @@ PHP_FUNCTION(strnatcmp) } /* }}} */ -/* {{{ proto array localeconv(void) +/* {{{ proto array localeconv(void) U Returns numeric formatting information based on the current locale */ PHP_FUNCTION(localeconv) { @@ -6443,8 +6451,12 @@ PHP_FUNCTION(localeconv) int len, i; /* We don't need no stinkin' parameters... */ - if (ZEND_NUM_ARGS() > 0) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; + } + + if (UG(unicode)) { + php_error_docref(NULL TSRMLS_DC, E_STRICT, "deprecated in Unicode mode, please use ICU locale functions"); } MAKE_STD_ZVAL(grouping); @@ -7045,7 +7057,7 @@ PHP_FUNCTION(str_word_count) /* }}} */ #if HAVE_STRFMON -/* {{{ proto string money_format(string format , float value) +/* {{{ proto string money_format(string format , float value) U Convert monetary value(s) to string */ PHP_FUNCTION(money_format) { @@ -7065,7 +7077,7 @@ PHP_FUNCTION(money_format) } str[str_len] = 0; - RETURN_STRINGL(erealloc(str, str_len + 1), str_len, 0); + RETURN_RT_STRINGL(erealloc(str, str_len + 1), str_len, 0); } /* }}} */ #endif diff --git a/unicode-progress.txt b/unicode-progress.txt index a54f12421c..3edcd28cf7 100644 --- a/unicode-progress.txt +++ b/unicode-progress.txt @@ -20,15 +20,6 @@ ext/standard Figure out if this is something we can use ICU for, internally. Check with Zeev. - localeconv() - Params API, update to use *_rt_* API. - - money_format() - Just IS_UNICODE support with *_rt_* API. - - nl_langinfo() - Params API, otherwise leave alone - parse_str() Params API. How do we deal with encoding of the data? @@ -150,6 +141,9 @@ ext/standard explode() implode() levenshtein() + localeconv() + money_format() + nl_langinfo() nl2br() ord() pathinfo() -- 2.40.0