]> granicus.if.org Git - php/commitdiff
- Let the caller output a warning instead of having
authorAndrei Zmievski <andrei@php.net>
Thu, 13 Jul 2006 21:27:48 +0000 (21:27 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 13 Jul 2006 21:27:48 +0000 (21:27 +0000)
  zend_get_unified_string_type() do it.
- Mark a few more functions are Unicode compatible.

Zend/zend_API.c
ext/standard/array.c
ext/standard/string.c
unicode-progress.txt

index c153bb7f6d2efcc2d83808382c5478e6600afb69..79e70c23a5fe606229c2025a02b11d8cfef0f88b 100644 (file)
@@ -3657,7 +3657,6 @@ ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...)
 
        /* We do not allow mixing binary and Unicode types */
        if (seen_string && seen_unicode) {
-               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                return (zend_uchar)-1;
        }
 
index fe634ec8fceb8e1b2a505748686cfe5a7fad8a14..ad808f0dbb54a155defbef9bf21ef8162fa510c2 100644 (file)
@@ -1691,7 +1691,7 @@ PHP_FUNCTION(array_fill)
 /* }}} */
 
 
-/* {{{ proto array range(mixed low, mixed high[, int step])
+/* {{{ proto array range(mixed low, mixed high[, int step]) U
    Create an array containing the range of integers or characters from low to high (inclusive) */
 PHP_FUNCTION(range)
 {
@@ -1723,6 +1723,7 @@ PHP_FUNCTION(range)
        /* Unify types */
        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zlow), Z_TYPE_P(zhigh));
        if (str_type == (zend_uchar)-1) {
+               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                return;
        }
        convert_to_explicit_type(zlow, str_type);
@@ -1946,7 +1947,7 @@ static void array_data_shuffle(zval *array TSRMLS_DC)
        efree(elems);
 }
 
-/* {{{ proto bool shuffle(array array_arg)
+/* {{{ proto bool shuffle(array array_arg) U
    Randomly shuffle the contents of an array */
 PHP_FUNCTION(shuffle)
 {
@@ -2533,7 +2534,7 @@ static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive)
 }
 
 
-/* {{{ proto array array_merge(array arr1, array arr2 [, array ...])
+/* {{{ proto array array_merge(array arr1, array arr2 [, array ...]) U
    Merges elements from passed arrays into one array */
 PHP_FUNCTION(array_merge)
 {
@@ -2542,7 +2543,7 @@ PHP_FUNCTION(array_merge)
 /* }}} */
 
 
-/* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...])
+/* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...]) U
    Recursively merges elements from passed arrays into one array */
 PHP_FUNCTION(array_merge_recursive)
 {
index a88fd25db0f8ab04f400e12fb431f2b4b70e0854..4f550466701a7dc37507ec20d8a90168aff23719 100644 (file)
@@ -2133,6 +2133,7 @@ PHP_FUNCTION(stristr)
                if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {
                        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
                        if (str_type == (zend_uchar)-1) {
+                               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                                return;
                        }
                        convert_to_explicit_type(haystack, str_type);
@@ -2441,6 +2442,7 @@ PHP_FUNCTION(stripos)
                if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {
                        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
                        if (str_type == (zend_uchar)-1) {
+                               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                                return;
                        }
                        convert_to_explicit_type(haystack, str_type);
@@ -2554,6 +2556,7 @@ PHP_FUNCTION(strrpos)
                if (Z_TYPE_P(zneedle) != Z_TYPE_P(zhaystack)) {
                        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(zhaystack), Z_TYPE_P(zneedle));
                        if (str_type == (zend_uchar)-1) {
+                               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                                return;
                        }
                        convert_to_explicit_type(zhaystack, str_type);
@@ -2777,6 +2780,7 @@ PHP_FUNCTION(strrchr)
                if (Z_TYPE_P(needle) != Z_TYPE_P(haystack)) {
                        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_P(haystack), Z_TYPE_P(needle));
                        if (str_type == (zend_uchar)-1) {
+                               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                                return;
                        }
                        convert_to_explicit_type(haystack, str_type);
@@ -3144,6 +3148,7 @@ PHP_FUNCTION(substr_replace)
                        if (tmp_repl && Z_TYPE_PP(str) != Z_TYPE_PP(tmp_repl)) {
                                str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(str), Z_TYPE_PP(tmp_repl));
                                if (str_type == (zend_uchar)-1) {
+                                       zend_error(E_WARNING, "Cannot mix binary and Unicode types");
                                        return;
                                }
                                convert_to_explicit_type_ex(str, str_type);
@@ -3221,6 +3226,7 @@ PHP_FUNCTION(substr_replace)
                        if (tmp_repl && Z_TYPE_PP(tmp_str) != Z_TYPE_PP(tmp_repl)) {
                                str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(tmp_str), Z_TYPE_PP(tmp_repl));
                                if (str_type == (zend_uchar)-1) {
+                                       zend_error(E_WARNING, "Cannot mix binary and Unicode types");
                                        return;
                                }
                                convert_to_explicit_type_ex(tmp_str, str_type);
@@ -4087,6 +4093,7 @@ PHP_FUNCTION(similar_text)
        }
        str_type = zend_get_unified_string_type(2 TSRMLS_CC, Z_TYPE_PP(t1), Z_TYPE_PP(t2));
        if (str_type == (zend_uchar)-1) {
+               zend_error(E_WARNING, "Cannot mix binary and Unicode parameters");
                return;
        }
        convert_to_explicit_type_ex(t1, str_type);
index 307fdb2a9e2f1d31e8bb66a89ad156e71440eb04..c1789acdf38e94480832eaa80c09ad4845571ea0 100644 (file)
@@ -49,9 +49,6 @@ ext/standard
     array_map()
         Params API, FCI cache, test
 
-    array_merge(), array_merge_recursive()
-        Test
-
     array_multisort()
         Add SORT_LOCALE_STRING, test
 
@@ -107,12 +104,6 @@ ext/standard
         Params API
         Either port strnatcmp() to support Unicode or maybe use ICU's numeric collation
 
-    range()
-        Test
-
-    shuffle()
-        Test
-
     sort(), rsort()
     asort(), arsort()
     ksort(), krsort() 
@@ -126,10 +117,14 @@ ext/standard
   array.c
   -------
     array_chunk() 
+    array_merge()
+    array_merge_recursive()
     compact()
     count()
     min()
     max()
+    range()
+    shuffle()
 
 
   string.c