Remove strnatcmp_ex() wrappers

These APIs always returned SUCCESS.

Closes GH-8195
This commit is contained in:
George Peter Banyard 2022-03-13 15:15:57 +00:00
parent db0db2204f
commit 71a110fcaa
No known key found for this signature in database
GPG Key ID: 3306078E3194AEBD
3 changed files with 6 additions and 30 deletions

View File

@ -29,6 +29,12 @@ PHP 8.2 INTERNALS UPGRADE NOTES
3. Module changes
========================
a. ext/standard
- The PHP APIs string_natural_compare_function_ex(),
string_natural_case_compare_function(), and string_natural_compare_function()
have been removed. They always returned SUCCESS and were a wrapper around
strnatcmp_ex(). Use strnatcmp_ex() directly instead.
========================
4. OpCode changes
========================

View File

@ -59,10 +59,6 @@ PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return
PHPAPI size_t php_strspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end);
PHPAPI size_t php_strcspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end);
PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, bool case_insensitive);
PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2);
PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2);
#if defined(_REENTRANT)
# ifdef PHP_WIN32
# include <wchar.h>

View File

@ -5406,32 +5406,6 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
}
/* }}} */
PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, bool case_insensitive) /* {{{ */
{
zend_string *tmp_str1, *tmp_str2;
zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1);
zend_string *str2 = zval_get_tmp_string(op2, &tmp_str2);
ZVAL_LONG(result, strnatcmp_ex(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2), case_insensitive));
zend_tmp_string_release(tmp_str1);
zend_tmp_string_release(tmp_str2);
return SUCCESS;
}
/* }}} */
PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
return string_natural_compare_function_ex(result, op1, op2, 1);
}
/* }}} */
PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
return string_natural_compare_function_ex(result, op1, op2, 0);
}
/* }}} */
/* {{{ Returns the result of string comparison using 'natural' algorithm */
PHP_FUNCTION(strnatcmp)
{