]> granicus.if.org Git - php/commitdiff
Remove HAVE_STRCOLL check
authorPeter Kokot <peterkokot@gmail.com>
Sun, 23 Jun 2019 13:51:24 +0000 (15:51 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Thu, 27 Jun 2019 22:05:55 +0000 (00:05 +0200)
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.

https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3

- Remove also SKIPIF strcoll check in test

Zend/zend_operators.c
Zend/zend_operators.h
configure.ac
ext/opcache/Optimizer/zend_func_info.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/php_string.h
ext/standard/string.c
ext/standard/tests/strings/strcoll.phpt
win32/build/config.w32
win32/build/config.w32.h.in

index f6ecd42562943f441b41b6acb5b40dc59cdf247a..f1ebb2e5df48688d27198774e624adb0d1e9da69 100644 (file)
@@ -1969,7 +1969,6 @@ ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2) /*
 }
 /* }}} */
 
-#if HAVE_STRCOLL
 ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2) /* {{{ */
 {
        zend_string *tmp_str1, *tmp_str2;
@@ -1982,7 +1981,6 @@ ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2)
        return ret;
 }
 /* }}} */
-#endif
 
 ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ */
 {
index c6a55c2b6dd2a5529024670dcdc569cb0f6b2676..69f91c0225b969896fdae32efcfedc219c5e1ec8 100644 (file)
@@ -394,9 +394,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
 ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, zend_bool case_insensitive);
 ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2);
 ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2);
-#if HAVE_STRCOLL
 ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2);
-#endif
 
 ZEND_API void         ZEND_FASTCALL zend_str_tolower(char *str, size_t length);
 ZEND_API char*        ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length);
index 0680a0acfa873dc2ef5a85b35042d90fa4870acf..9beb461ab56a214ee3f23076613f82cf2c4ae758 100644 (file)
@@ -644,7 +644,6 @@ statfs \
 statvfs \
 std_syslog \
 strcasecmp \
-strcoll \
 strdup \
 strerror \
 strnlen \
index 22715a60890aef0a0b9f15806cecddfe755a1d36..36a3677d910d753c4f4be425ef6c4e58594defb5 100644 (file)
@@ -335,9 +335,7 @@ static const func_info_t func_infos[] = {
        F1("str_split",                    MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
        F1("strpbrk",                      MAY_BE_FALSE | MAY_BE_STRING),
        F0("substr_compare",               MAY_BE_FALSE | MAY_BE_LONG),
-#ifdef HAVE_STRCOLL
        F0("strcoll",                      MAY_BE_NULL | MAY_BE_LONG),
-#endif
 #ifdef HAVE_STRFMON
        F1("money_format",                 MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
 #endif
index b90f24ae636644364e21f613ccbb3467421bacf5..068acf33bc799beabace8beec5c015f1b505faa0 100644 (file)
@@ -327,7 +327,6 @@ static int php_array_reverse_key_compare_string_natural(const void *a, const voi
 }
 /* }}} */
 
-#if HAVE_STRCOLL
 static int php_array_key_compare_string_locale(const void *a, const void *b) /* {{{ */
 {
        Bucket *f = (Bucket *) a;
@@ -355,7 +354,6 @@ static int php_array_reverse_key_compare_string_locale(const void *a, const void
        return php_array_key_compare_string_locale(b, a);
 }
 /* }}} */
-#endif
 
 /* Numbers are always smaller than strings int this function as it
  * anyway doesn't make much sense to compare two different data types.
@@ -528,7 +526,6 @@ static int php_array_reverse_natural_case_compare(const void *a, const void *b)
 }
 /* }}} */
 
-#if HAVE_STRCOLL
 static int php_array_data_compare_string_locale(const void *a, const void *b) /* {{{ */
 {
        Bucket *f;
@@ -558,7 +555,6 @@ static int php_array_reverse_data_compare_string_locale(const void *a, const voi
        return php_array_data_compare_string_locale(b, a);
 }
 /* }}} */
-#endif
 
 static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse) /* {{{ */
 {
@@ -603,7 +599,6 @@ static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse)
                        }
                        break;
 
-#if HAVE_STRCOLL
                case PHP_SORT_LOCALE_STRING:
                        if (reverse) {
                                return php_array_reverse_key_compare_string_locale;
@@ -611,7 +606,6 @@ static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse)
                                return php_array_key_compare_string_locale;
                        }
                        break;
-#endif
 
                case PHP_SORT_REGULAR:
                default:
@@ -669,7 +663,6 @@ static compare_func_t php_get_data_compare_func(zend_long sort_type, int reverse
                        }
                        break;
 
-#if HAVE_STRCOLL
                case PHP_SORT_LOCALE_STRING:
                        if (reverse) {
                                return php_array_reverse_data_compare_string_locale;
@@ -677,7 +670,6 @@ static compare_func_t php_get_data_compare_func(zend_long sort_type, int reverse
                                return php_array_data_compare_string_locale;
                        }
                        break;
-#endif
 
                case PHP_SORT_REGULAR:
                default:
@@ -5709,9 +5701,7 @@ PHP_FUNCTION(array_multisort)
                                case PHP_SORT_NUMERIC:
                                case PHP_SORT_STRING:
                                case PHP_SORT_NATURAL:
-#if HAVE_STRCOLL
                                case PHP_SORT_LOCALE_STRING:
-#endif
                                        /* flag allowed here */
                                        if (parse_state[MULTISORT_TYPE] == 1) {
                                                /* Save the flag and make sure then next arg is not the current flag. */
index 9188b5b0972a0751206eb6843137c91657fbc342..6bbd24f6cc284419a4e120750523d6f80a3e5486 100644 (file)
@@ -2162,12 +2162,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
 ZEND_END_ARG_INFO()
 #endif
 
-#ifdef HAVE_STRCOLL
 ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0)
        ZEND_ARG_INFO(0, str1)
        ZEND_ARG_INFO(0, str2)
 ZEND_END_ARG_INFO()
-#endif
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1)
        ZEND_ARG_INFO(0, str)
@@ -2803,10 +2801,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
        PHP_FE(substr_compare,                                                                                                  arginfo_substr_compare)
        PHP_FE(utf8_encode,                                                                                                     arginfo_utf8_encode)
        PHP_FE(utf8_decode,                                                                                                     arginfo_utf8_decode)
-
-#ifdef HAVE_STRCOLL
        PHP_FE(strcoll,                                                                                                                 arginfo_strcoll)
-#endif
 
 #ifdef HAVE_STRFMON
        PHP_FE(money_format,                                                                                                    arginfo_money_format)
@@ -4140,10 +4135,10 @@ PHP_FUNCTION(getenv)
 #else
 
     tsrm_env_lock();
-    
+
        /* system method returns a const */
        ptr = getenv(str);
-       
+
        if (ptr) {
                RETVAL_STRING(ptr);
        }
index 53209f4485199a2d2e085494e1f778ed0195a5dc..0bf88cb741d9c02840288ab2a30d462e4a1146fb 100644 (file)
@@ -91,9 +91,7 @@ PHP_FUNCTION(strpbrk);
 PHP_FUNCTION(substr_compare);
 PHP_FUNCTION(utf8_encode);
 PHP_FUNCTION(utf8_decode);
-#ifdef HAVE_STRCOLL
 PHP_FUNCTION(strcoll);
-#endif
 #if HAVE_STRFMON
 PHP_FUNCTION(money_format);
 #endif
index 78b726c87ff937a568ca03821d36a00fc1674be8..f8b808d1adbfb6f20bbb43f33ad91179e5d5fc5c 100644 (file)
@@ -701,7 +701,6 @@ PHP_FUNCTION(nl_langinfo)
 #endif
 /* }}} */
 
-#ifdef HAVE_STRCOLL
 /* {{{ proto int strcoll(string str1, string str2)
    Compares two strings using the current locale */
 PHP_FUNCTION(strcoll)
@@ -717,7 +716,6 @@ PHP_FUNCTION(strcoll)
                            (const char *) ZSTR_VAL(s2)));
 }
 /* }}} */
-#endif
 
 /* {{{ php_charmask
  * Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
index 0d78ff37be48096b83262298e7ab011075774712..37fe251b667e070a24341c9d225d0a673e84bd12 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 Testing Basic behaviour of strcoll()
---SKIPIF--
-<?php if (!function_exists('strcoll')) die('skip strcoll function not available') ?>
 --CREDITS--
 Sebastian Schürmann
 sebs@php.net
index 38d1fa2295b4c59aab4226ef124a001e38757ef5..e01f38b8f3a837e2a537d0569f57e3834def776d 100644 (file)
@@ -300,7 +300,6 @@ ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
 ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
 
 AC_DEFINE('HAVE_USLEEP', 1);
-AC_DEFINE('HAVE_STRCOLL', 1);
 
 /* For snapshot builders, where can we find the additional
  * files that make up the snapshot template? */
index 0403f6c5428bbf61764e24f28bfd949917925388..3af5fbecf677ff9e95029022e19c3b66dbd913d4 100644 (file)
 #define PHP_SHLIB_EXT_PREFIX "php_"
 #define HAVE_SQLDATASOURCES
 
-/* Win32 supports strcoll */
-#define HAVE_STRCOLL 1
-
 /* Win32 supports socketpair by the emulation in win32/sockets.c */
 #define HAVE_SOCKETPAIR 1
 #define HAVE_SOCKLEN_T 1