]> granicus.if.org Git - php/commitdiff
New parameter parsing API for string, part I
authorOlivier Hill <ohill@php.net>
Sun, 22 Jun 2008 19:22:41 +0000 (19:22 +0000)
committerOlivier Hill <ohill@php.net>
Sun, 22 Jun 2008 19:22:41 +0000 (19:22 +0000)
16 files changed:
ext/standard/string.c
ext/standard/tests/strings/chop_error.phpt
ext/standard/tests/strings/chop_variation1.phpt
ext/standard/tests/strings/chop_variation2.phpt
ext/standard/tests/strings/chunk_split_variation1.phpt
ext/standard/tests/strings/dirname_error.phpt
ext/standard/tests/strings/explode1.phpt
ext/standard/tests/strings/implode1.phpt
ext/standard/tests/strings/join_error.phpt
ext/standard/tests/strings/ltrim.phpt
ext/standard/tests/strings/rtrim.phpt
ext/standard/tests/strings/strpos.phpt
ext/standard/tests/strings/strrchr_error.phpt
ext/standard/tests/strings/strrchr_variation11.phpt
ext/standard/tests/strings/strrchr_variation9.phpt
ext/standard/tests/strings/trim1.phpt

index b3288882ee77aec3cf85cda586081b542f58da96..916f9e15a7b1ff5dcb722d141cf3c26b89db20a7 100644 (file)
@@ -182,16 +182,14 @@ PHP_MSHUTDOWN_FUNCTION(localeconv)
    Converts the binary representation of data to hex */
 PHP_FUNCTION(bin2hex)
 {
-       zval **data;
-       char *result;
-       size_t newlen;
+       char *result, *data;
+       size_t newlen, datalen;
 
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(data);
 
-       result = php_bin2hex(Z_STRVAL_PP(data), Z_STRLEN_PP(data), &newlen);
+       result = php_bin2hex(data, datalen, &newlen);
        
        if (!result) {
                RETURN_FALSE;
@@ -637,16 +635,15 @@ PHP_FUNCTION(nl_langinfo)
    Compares two strings using the current locale */
 PHP_FUNCTION(strcoll)
 {
-       zval **s1, **s2;
-
-       if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       char *s1, *s2;
+       int s1len, s2len;
+       
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(s1);
-       convert_to_string_ex(s2);
 
-       RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1)
-                           (const char *) Z_STRVAL_PP(s2)));
+       RETURN_LONG(strcoll((const char *) s1
+                           (const char *) s2));
 }
 /* }}} */
 #endif
@@ -752,22 +749,15 @@ PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_v
  */
 static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
 {
-       zval **str;
-       zval **what = NULL;
-       int    argc = ZEND_NUM_ARGS();
-
-       if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &str, &what) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-
-       convert_to_string_ex(str);
-
-       if (argc > 1) {
-               convert_to_string_ex(what);
-               php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), Z_STRVAL_PP(what), Z_STRLEN_PP(what), return_value, mode TSRMLS_CC);
-       } else {
-               php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), NULL, 0, return_value, mode TSRMLS_CC);
+       char *str;
+       char *what = NULL;
+       int str_len, what_len = 0;
+       
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) {
+               return;
        }
+       
+       php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC);
 }
 /* }}} */
 
@@ -1010,18 +1000,14 @@ PHP_FUNCTION(explode)
        zval **str, **delim, **zlimit = NULL;
        int limit = -1;
        int argc = ZEND_NUM_ARGS();
-
-       if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &delim, &str, &zlimit) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &delim, &str, &limit) == FAILURE) {
+               return;
        }
+       
        convert_to_string_ex(str);
        convert_to_string_ex(delim);
 
-       if (argc > 2) {
-               convert_to_long_ex(zlimit);
-               limit = Z_LVAL_PP(zlimit);
-       }
-
        if (! Z_STRLEN_PP(delim)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
                RETURN_FALSE;
@@ -1140,15 +1126,13 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
 PHP_FUNCTION(implode)
 {
        zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
-       int argc = ZEND_NUM_ARGS();
        HashPosition pos;
 
-       if (argc < 1 || argc > 2 ||
-               zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &arg1, &arg2) == FAILURE) {
+               return;
        }
-
-       if (argc == 1) {
+       
+       if (arg2 == NULL) {
                if (Z_TYPE_PP(arg1) != IS_ARRAY) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument must be an array");
                        return;
@@ -1181,7 +1165,7 @@ PHP_FUNCTION(implode)
 
        Z_ARRVAL_P(arr)->pInternalPointer = pos;
 
-       if (argc == 1) {
+       if (arg2 == NULL) {
                FREE_ZVAL(delim);
        }
 }
@@ -1300,15 +1284,16 @@ PHPAPI char *php_strtoupper(char *s, size_t len)
    Makes a string uppercase */
 PHP_FUNCTION(strtoupper)
 {
-       zval **arg;
+       char *arg;
+       int arglen;
        
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(arg);
 
-       RETVAL_ZVAL(*arg, 1, 0);
-       php_strtoupper(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
+       php_strtoupper(arg, arglen);
+       
+       RETURN_STRINGL(arg, arglen, 1);
 }
 /* }}} */
 
@@ -1333,16 +1318,15 @@ PHPAPI char *php_strtolower(char *s, size_t len)
    Makes a string lowercase */
 PHP_FUNCTION(strtolower)
 {
-       zval **str;
-       char *ret;
+       char *str;
+       int arglen;
        
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str)) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(str);
 
-       RETVAL_ZVAL(*str, 1, 0);
-       ret = php_strtolower(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
+       php_strtolower(str, arglen);
+       RETURN_STRINGL(str, arglen, 1);
 }
 /* }}} */
 
@@ -1448,17 +1432,17 @@ PHPAPI size_t php_dirname(char *path, size_t len)
    Returns the directory name component of the path */
 PHP_FUNCTION(dirname)
 {
-       zval **str;
+       char *str;
        char *ret;
+       int str_len;
        size_t ret_len;
 
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(str);
-
-       ret = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
-       ret_len = php_dirname(ret, Z_STRLEN_PP(str));
+       
+       ret = estrndup(str, str_len);
+       ret_len = php_dirname(ret, str_len);
 
        RETURN_STRINGL(ret, ret_len, 0);
 }
@@ -1701,23 +1685,18 @@ PHP_FUNCTION(strstr)
    Finds position of first occurrence of a string within another */
 PHP_FUNCTION(strpos)
 {
-       zval **haystack, **needle, **z_offset;
+       zval **needle;
+       char *haystack;
        char *found = NULL;
        char  needle_char[2];
        int   offset = 0;
-       int   argc = ZEND_NUM_ARGS();
-
-       if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &haystack, &needle, &z_offset) == FAILURE) {
-               WRONG_PARAM_COUNT;
-       }
-       convert_to_string_ex(haystack);
-
-       if (argc > 2) {
-               convert_to_long_ex(z_offset);
-               offset = Z_LVAL_PP(z_offset);
+       int   haystack_len;
+       
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) {
+               return;
        }
 
-       if (offset < 0 || offset > Z_STRLEN_PP(haystack)) {
+       if (offset < 0 || offset > haystack_len) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
                RETURN_FALSE;
        }
@@ -1728,23 +1707,23 @@ PHP_FUNCTION(strpos)
                        RETURN_FALSE;
                }
 
-               found = php_memnstr(Z_STRVAL_PP(haystack) + offset,
+               found = php_memnstr(haystack + offset,
                                        Z_STRVAL_PP(needle),
                                        Z_STRLEN_PP(needle),
-                                       Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
+                                       haystack + haystack_len);
        } else {
                convert_to_long_ex(needle);
                needle_char[0] = (char) Z_LVAL_PP(needle);
                needle_char[1] = 0;
 
-               found = php_memnstr(Z_STRVAL_PP(haystack) + offset,
+               found = php_memnstr(haystack + offset,
                                                        needle_char,
                                                        1,
-                                   Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
+                                   haystack + haystack_len);
        }
 
        if (found) {
-               RETURN_LONG(found - Z_STRVAL_PP(haystack));
+               RETURN_LONG(found - haystack);
        } else {
                RETURN_FALSE;
        }
@@ -2003,26 +1982,26 @@ PHP_FUNCTION(strripos)
    Finds the last occurrence of a character in a string within another */
 PHP_FUNCTION(strrchr)
 {
-       zval **haystack, **needle;
+       zval **needle;
+       char *haystack;
        char *found = NULL;
        long found_offset;
+       int  haystack_len;
        
-       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) ==
-               FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ", &haystack, &haystack_len, &needle) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(haystack);
 
        if (Z_TYPE_PP(needle) == IS_STRING) {
-               found = zend_memrchr(Z_STRVAL_PP(haystack), *Z_STRVAL_PP(needle), Z_STRLEN_PP(haystack));
+               found = zend_memrchr(haystack, *Z_STRVAL_PP(needle), haystack_len);
        } else {
                convert_to_long_ex(needle);
-               found = zend_memrchr(Z_STRVAL_PP(haystack), (char) Z_LVAL_PP(needle), Z_STRLEN_PP(haystack));
+               found = zend_memrchr(haystack, (char) Z_LVAL_PP(needle), haystack_len);
        }
 
        if (found) {
-               found_offset = found - Z_STRVAL_PP(haystack);
-               RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - found_offset, 1);
+               found_offset = found - haystack;
+               RETURN_STRINGL(found, haystack_len - found_offset, 1);
        } else {
                RETURN_FALSE;
        }
@@ -2085,20 +2064,20 @@ static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int c
    Returns split line */
 PHP_FUNCTION(chunk_split) 
 {
-       zval **p_str, **p_chunklen, **p_ending;
+       zval **p_chunklen, **p_ending;
+       char *str;
        char *result;
        char *end    = "\r\n";
        int endlen   = 2;
        long chunklen = 76;
        int result_len;
        int argc = ZEND_NUM_ARGS();
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|ZZ", &p_str, &p_chunklen, &p_ending) == FAILURE) {
+       int str_len;
+       
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ZZ", &str, &str_len, &p_chunklen, &p_ending) == FAILURE) {
                return;
        }
 
-       convert_to_string_ex(p_str);
-
        if (argc > 1) {
                convert_to_long_ex(p_chunklen);
                chunklen = Z_LVAL_PP(p_chunklen);
@@ -2115,21 +2094,21 @@ PHP_FUNCTION(chunk_split)
                RETURN_FALSE;
        }
 
-       if (chunklen > Z_STRLEN_PP(p_str)) {
+       if (chunklen > str_len) {
                /* to maintain BC, we must return original string + ending */
-               result_len = endlen + Z_STRLEN_PP(p_str);
+               result_len = endlen + str_len;
                result = emalloc(result_len + 1);
-               memcpy(result, Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str));
-               memcpy(result + Z_STRLEN_PP(p_str), end, endlen);
+               memcpy(result, str, str_len);
+               memcpy(result + str_len, end, endlen);
                result[result_len] = '\0'; 
                RETURN_STRINGL(result, result_len, 0);  
        }
 
-       if (!Z_STRLEN_PP(p_str)) {
+       if (!str_len) {
                RETURN_EMPTY_STRING();
        }
 
-       result = php_chunk_split(Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str), end, endlen, chunklen, &result_len);
+       result = php_chunk_split(str, str_len, end, endlen, chunklen, &result_len);
 
        if (result) {
                RETURN_STRINGL(result, result_len, 0);
index 4269993a2a97a38c6863bca055cb5369cf3b4b59..71a1004ecd5b43b163006638962b81e84c60966d 100644 (file)
@@ -33,12 +33,12 @@ echo "Done\n";
 
 -- Testing chop() function with Zero arguments --
 
-Warning: Wrong parameter count for chop() in %s on line %d
+Warning: chop() expects at least 1 parameter, 0 given in %s on line %d
 NULL
 
 -- Testing chop() function with more than expected no. of arguments --
 
-Warning: Wrong parameter count for chop() in %s on line %d
+Warning: chop() expects at most 2 parameters, 3 given in %s on line %d
 NULL
 string(11) "string_val "
 Done
index 3c403e76649063ecdfb5b82cb58e3f045b92e9ad..de5ecd81646430ae7dff02e6a3f7503196d5a96c 100644 (file)
@@ -138,39 +138,39 @@ string(3) "0.5"
 string(2) "0."
 -- Iteration 10 --
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 11 --
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 12 --
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 13 --
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 14 --
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+Warning: chop() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 15 --
 string(1) "1"
 string(0) ""
@@ -205,6 +205,10 @@ string(0) ""
 string(16) " @#$%Object @#$%"
 string(11) " @#$%Object"
 -- Iteration 26 --
-string(%d) "Resource id #%d"
-string(11) "Resource id"
+
+Warning: chop() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: chop() expects parameter 1 to be string, resource given in %s on line %d
+NULL
 Done
index ef531ad02c42ec73f675b5241001774b0680cd77..f0416e77bc14e347f0fe1472d6c5cdb260122509 100644 (file)
@@ -128,24 +128,24 @@ string(17) "hello world12345 "
 string(17) "hello world12345 "
 -- Iteration 10 --
 
-Notice: Array to string conversion in %s on line %d
-string(17) "hello world12345 "
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
 -- Iteration 11 --
 
-Notice: Array to string conversion in %s on line %d
-string(17) "hello world12345 "
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
 -- Iteration 12 --
 
-Notice: Array to string conversion in %s on line %d
-string(17) "hello world12345 "
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
 -- Iteration 13 --
 
-Notice: Array to string conversion in %s on line %d
-string(17) "hello world12345 "
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
 -- Iteration 14 --
 
-Notice: Array to string conversion in %s on line %d
-string(17) "hello world12345 "
+Warning: chop() expects parameter 2 to be string, array given in %s on line %d
+NULL
 -- Iteration 15 --
 string(17) "hello world12345 "
 -- Iteration 16 --
@@ -165,7 +165,9 @@ string(17) "hello world12345 "
 -- Iteration 23 --
 string(17) "hello world12345 "
 -- Iteration 24 --
-string(%d) "%s"
+
+Warning: chop() expects parameter 2 to be string, resource given in %s on line %d
+NULL
 -- Iteration 25 --
 string(17) "hello world12345 "
 -- Iteration 26 --
index 624587cedaa9b8af74dcbd9c0afad21b00b7df61..5f41c86dc3ab1ac362e16a32070bd8c6de096674 100644 (file)
@@ -118,24 +118,24 @@ string(20) "1. 07 65 43 21 E- 9 "
 string(5) "0. 5 "
 -- Iteration 10 --
 
-Notice: Array to string conversion in %s on line 87
-string(8) "Ar ra y "
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
 -- Iteration 11 --
 
-Notice: Array to string conversion in %s on line 87
-string(8) "Ar ra y "
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
 -- Iteration 12 --
 
-Notice: Array to string conversion in %s on line 87
-string(8) "Ar ra y "
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
 -- Iteration 13 --
 
-Notice: Array to string conversion in %s on line 87
-string(8) "Ar ra y "
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
 -- Iteration 14 --
 
-Notice: Array to string conversion in %s on line 87
-string(8) "Ar ra y "
+Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
+NULL
 -- Iteration 15 --
 string(1) " "
 -- Iteration 16 --
@@ -163,5 +163,7 @@ string(1) " "
 -- Iteration 27 --
 string(1) " "
 -- Iteration 28 --
-string(%d) "Re so ur ce  i d  #%s "
-Done
\ No newline at end of file
+
+Warning: chunk_split() expects parameter 1 to be string, resource given in %s on line 87
+NULL
+Done
index 3671695108961c8882063ca4f5602a42bc2fc377..bf6310283b47bae577328c6f458b40aebae5072b 100644 (file)
@@ -17,9 +17,9 @@ echo "Done\n";
 --EXPECTF--
 *** Testing error conditions ***
 
-Warning: Wrong parameter count for dirname() in %s on line %d
+Warning: dirname() expects exactly 1 parameter, 0 given in %s on line %d
 NULL
 
-Warning: Wrong parameter count for dirname() in %s on line %d
+Warning: dirname() expects exactly 1 parameter, 2 given in %s on line %d
 NULL
 Done
index 2d56cd0aa471f0131c16ac29fe2668960b74c16a..669b66272daf416d4e73884e34bea4a58ab79d29 100644 (file)
@@ -501,9 +501,9 @@ array(2) {
 
 *** Testing error conditions ***
 
-Warning: Wrong parameter count for explode() in %s on line %d
+Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
 NULL
 
-Warning: Wrong parameter count for explode() in %s on line %d
+Warning: explode() expects at least 2 parameters, 1 given in %s on line %d
 NULL
 Done
index fccb09e62fdfd53b75a8348d0c4091053cc5d287..4d3502f18ab135a9c6811b0c529aaaebdefa6f91 100644 (file)
Binary files a/ext/standard/tests/strings/implode1.phpt and b/ext/standard/tests/strings/implode1.phpt differ
index aa6bdc23061ec60067e18b7b4a640e85ae63d40f..b283bf4cdbd867c9e745609db832f3f974689928 100644 (file)
@@ -35,12 +35,12 @@ echo "Done\n";
 
 -- Testing join() function with Zero arguments --
 
-Warning: Wrong parameter count for join() in %s on line %d
+Warning: join() expects at least 1 parameter, 0 given in %s on line %d
 NULL
 
 -- Testing join() function with more than expected no. of arguments --
 
-Warning: Wrong parameter count for join() in %s on line %d
+Warning: join() expects at most 2 parameters, 3 given in %s on line %d
 NULL
 
 -- Testing join() with less than expected no. of arguments --
index cb64b9cd32c5df53a54c1360d74ba4830a2f025f..cddce246881c26f7db5735877be1a15a9c12dafb 100644 (file)
@@ -52,12 +52,12 @@ echo "\nDone\n";
 
  *** Output for zero argument ***
 
-Warning: Wrong parameter count for ltrim() in %s on line %d
+Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
 NULL
 
  *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***
 
-Warning: Wrong parameter count for ltrim() in %s on line %d
+Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
 NULL
 
  *** Using heredoc string ***
index 329ead420109744c0bdc50470d042edb91be719e..5f57b0e850f4543d9b150db857b3fc822517b904 100644 (file)
Binary files a/ext/standard/tests/strings/rtrim.phpt and b/ext/standard/tests/strings/rtrim.phpt differ
index 566ef6c75c6d71ae463c5a07be90200f71a86fef..dbc5d6d970b0a6c3765984fee4a6938c1e109650 100644 (file)
Binary files a/ext/standard/tests/strings/strpos.phpt and b/ext/standard/tests/strings/strpos.phpt differ
index 8c2881aa531da2b994480f520d95ddfcbc65dda3..aa0adf4b85d3cd25f0be090b49c5f3499f6361bd 100644 (file)
@@ -27,14 +27,14 @@ echo "*** Done ***";
 *** Testing strrchr() function: error conditions ***
 
 -- Testing strrchr() function with Zero arguments --
-Warning: Wrong parameter count for strrchr() in %s on line %d
+Warning: strrchr() expects exactly 2 parameters, 0 given in %s on line %d
 NULL
 
 -- Testing strrchr() function with less than expected no. of arguments --
-Warning: Wrong parameter count for strrchr() in %s on line %d
+Warning: strrchr() expects exactly 2 parameters, 1 given in %s on line %d
 NULL
 
 -- Testing strrchr() function with more than expected no. of arguments --
-Warning: Wrong parameter count for strrchr() in %s on line %d
+Warning: strrchr() expects exactly 2 parameters, 3 given in %s on line %d
 NULL
 *** Done ***
index a179c4089a7eaccd35b97535f2c083b6b8480e02..ea2e7a68d2860f60d8b888387be9dc713f36d9a4 100644 (file)
@@ -110,24 +110,24 @@ bool(false)
 bool(false)
 -- Iteration 10 --
 
-Notice: Array to string conversion in %s on line %d
-bool(false)
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 11 --
 
-Notice: Array to string conversion in %s on line %d
-bool(false)
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 12 --
 
-Notice: Array to string conversion in %s on line %d
-bool(false)
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 13 --
 
-Notice: Array to string conversion in %s on line %d
-bool(false)
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 14 --
 
-Notice: Array to string conversion in %s on line %d
-bool(false)
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 15 --
 bool(false)
 -- Iteration 16 --
@@ -149,7 +149,9 @@ bool(false)
 -- Iteration 23 --
 bool(false)
 -- Iteration 24 --
-%s
+
+Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
+NULL
 -- Iteration 25 --
 bool(false)
 -- Iteration 26 --
index cd4c5b2c32070f4faaaa140c2dec5aa21a362a5d..a41c091212149efe825c7e9a70f7897fa42e9175 100644 (file)
@@ -151,24 +151,24 @@ string(7) "1.06E-9"
 string(2) ".5"
 -- Iteration 10 --
 
-Notice: Array to string conversion in %s on line %d
-string(2) "ay"
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 11 --
 
-Notice: Array to string conversion in %s on line %d
-string(2) "ay"
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 12 --
 
-Notice: Array to string conversion in %s on line %d
-string(3) "ray"
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 13 --
 
-Notice: Array to string conversion in %s on line %d
-string(1) "y"
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 14 --
 
-Notice: Array to string conversion in %s on line %d
-string(2) "ay"
+Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
+NULL
 -- Iteration 15 --
 bool(false)
 -- Iteration 16 --
@@ -188,7 +188,9 @@ bool(false)
 -- Iteration 23 --
 bool(false)
 -- Iteration 24 --
-bool(false)
+
+Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
+NULL
 -- Iteration 25 --
 bool(false)
 -- Iteration 26 --
index 4d89d0cf33e1078b6b7dee11af57aed99a512e2f..b9323afbdf6e8903e1a2be1534680c41373ec97e 100644 (file)
Binary files a/ext/standard/tests/strings/trim1.phpt and b/ext/standard/tests/strings/trim1.phpt differ