New parameter parsing API for string, part I

This commit is contained in:
Olivier Hill 2008-06-22 19:22:41 +00:00
parent 44fe6a6005
commit 906b5b80df
16 changed files with 173 additions and 182 deletions

View file

@ -182,16 +182,14 @@ PHP_MSHUTDOWN_FUNCTION(localeconv)
Converts the binary representation of data to hex */ Converts the binary representation of data to hex */
PHP_FUNCTION(bin2hex) PHP_FUNCTION(bin2hex)
{ {
zval **data; char *result, *data;
char *result; size_t newlen, datalen;
size_t newlen;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) {
WRONG_PARAM_COUNT; 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) { if (!result) {
RETURN_FALSE; RETURN_FALSE;
@ -637,16 +635,15 @@ PHP_FUNCTION(nl_langinfo)
Compares two strings using the current locale */ Compares two strings using the current locale */
PHP_FUNCTION(strcoll) PHP_FUNCTION(strcoll)
{ {
zval **s1, **s2; char *s1, *s2;
int s1len, s2len;
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(s1);
convert_to_string_ex(s2);
RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1), RETURN_LONG(strcoll((const char *) s1,
(const char *) Z_STRVAL_PP(s2))); (const char *) s2));
} }
/* }}} */ /* }}} */
#endif #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) static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
{ {
zval **str; char *str;
zval **what = NULL; char *what = NULL;
int argc = ZEND_NUM_ARGS(); int str_len, what_len = 0;
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &str, &what) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(str); php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC);
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);
}
} }
/* }}} */ /* }}} */
@ -1011,17 +1001,13 @@ PHP_FUNCTION(explode)
int limit = -1; int limit = -1;
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &delim, &str, &zlimit) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &delim, &str, &limit) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(str); convert_to_string_ex(str);
convert_to_string_ex(delim); convert_to_string_ex(delim);
if (argc > 2) {
convert_to_long_ex(zlimit);
limit = Z_LVAL_PP(zlimit);
}
if (! Z_STRLEN_PP(delim)) { if (! Z_STRLEN_PP(delim)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE; RETURN_FALSE;
@ -1140,15 +1126,13 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
PHP_FUNCTION(implode) PHP_FUNCTION(implode)
{ {
zval **arg1 = NULL, **arg2 = NULL, *delim, *arr; zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
int argc = ZEND_NUM_ARGS();
HashPosition pos; HashPosition pos;
if (argc < 1 || argc > 2 || if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &arg1, &arg2) == FAILURE) {
zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) { return;
WRONG_PARAM_COUNT;
} }
if (argc == 1) { if (arg2 == NULL) {
if (Z_TYPE_PP(arg1) != IS_ARRAY) { if (Z_TYPE_PP(arg1) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument must be an array"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument must be an array");
return; return;
@ -1181,7 +1165,7 @@ PHP_FUNCTION(implode)
Z_ARRVAL_P(arr)->pInternalPointer = pos; Z_ARRVAL_P(arr)->pInternalPointer = pos;
if (argc == 1) { if (arg2 == NULL) {
FREE_ZVAL(delim); FREE_ZVAL(delim);
} }
} }
@ -1300,15 +1284,16 @@ PHPAPI char *php_strtoupper(char *s, size_t len)
Makes a string uppercase */ Makes a string uppercase */
PHP_FUNCTION(strtoupper) PHP_FUNCTION(strtoupper)
{ {
zval **arg; char *arg;
int arglen;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(arg);
RETVAL_ZVAL(*arg, 1, 0); php_strtoupper(arg, arglen);
php_strtoupper(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value));
RETURN_STRINGL(arg, arglen, 1);
} }
/* }}} */ /* }}} */
@ -1333,16 +1318,15 @@ PHPAPI char *php_strtolower(char *s, size_t len)
Makes a string lowercase */ Makes a string lowercase */
PHP_FUNCTION(strtolower) PHP_FUNCTION(strtolower)
{ {
zval **str; char *str;
char *ret; int arglen;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str)) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(str);
RETVAL_ZVAL(*str, 1, 0); php_strtolower(str, arglen);
ret = php_strtolower(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value)); 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 */ Returns the directory name component of the path */
PHP_FUNCTION(dirname) PHP_FUNCTION(dirname)
{ {
zval **str; char *str;
char *ret; char *ret;
int str_len;
size_t ret_len; size_t ret_len;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
WRONG_PARAM_COUNT; return;
} }
convert_to_string_ex(str);
ret = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str)); ret = estrndup(str, str_len);
ret_len = php_dirname(ret, Z_STRLEN_PP(str)); ret_len = php_dirname(ret, str_len);
RETURN_STRINGL(ret, ret_len, 0); RETURN_STRINGL(ret, ret_len, 0);
} }
@ -1701,23 +1685,18 @@ PHP_FUNCTION(strstr)
Finds position of first occurrence of a string within another */ Finds position of first occurrence of a string within another */
PHP_FUNCTION(strpos) PHP_FUNCTION(strpos)
{ {
zval **haystack, **needle, **z_offset; zval **needle;
char *haystack;
char *found = NULL; char *found = NULL;
char needle_char[2]; char needle_char[2];
int offset = 0; int offset = 0;
int argc = ZEND_NUM_ARGS(); int haystack_len;
if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &haystack, &needle, &z_offset) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) {
WRONG_PARAM_COUNT; return;
}
convert_to_string_ex(haystack);
if (argc > 2) {
convert_to_long_ex(z_offset);
offset = Z_LVAL_PP(z_offset);
} }
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"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1728,23 +1707,23 @@ PHP_FUNCTION(strpos)
RETURN_FALSE; RETURN_FALSE;
} }
found = php_memnstr(Z_STRVAL_PP(haystack) + offset, found = php_memnstr(haystack + offset,
Z_STRVAL_PP(needle), Z_STRVAL_PP(needle),
Z_STRLEN_PP(needle), Z_STRLEN_PP(needle),
Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack)); haystack + haystack_len);
} else { } else {
convert_to_long_ex(needle); convert_to_long_ex(needle);
needle_char[0] = (char) Z_LVAL_PP(needle); needle_char[0] = (char) Z_LVAL_PP(needle);
needle_char[1] = 0; needle_char[1] = 0;
found = php_memnstr(Z_STRVAL_PP(haystack) + offset, found = php_memnstr(haystack + offset,
needle_char, needle_char,
1, 1,
Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack)); haystack + haystack_len);
} }
if (found) { if (found) {
RETURN_LONG(found - Z_STRVAL_PP(haystack)); RETURN_LONG(found - haystack);
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -2003,26 +1982,26 @@ PHP_FUNCTION(strripos)
Finds the last occurrence of a character in a string within another */ Finds the last occurrence of a character in a string within another */
PHP_FUNCTION(strrchr) PHP_FUNCTION(strrchr)
{ {
zval **haystack, **needle; zval **needle;
char *haystack;
char *found = NULL; char *found = NULL;
long found_offset; long found_offset;
int haystack_len;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ", &haystack, &haystack_len, &needle) == FAILURE) {
FAILURE) { return;
WRONG_PARAM_COUNT;
} }
convert_to_string_ex(haystack);
if (Z_TYPE_PP(needle) == IS_STRING) { 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 { } else {
convert_to_long_ex(needle); 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) { if (found) {
found_offset = found - Z_STRVAL_PP(haystack); found_offset = found - haystack;
RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - found_offset, 1); RETURN_STRINGL(found, haystack_len - found_offset, 1);
} else { } else {
RETURN_FALSE; RETURN_FALSE;
} }
@ -2085,20 +2064,20 @@ static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int c
Returns split line */ Returns split line */
PHP_FUNCTION(chunk_split) PHP_FUNCTION(chunk_split)
{ {
zval **p_str, **p_chunklen, **p_ending; zval **p_chunklen, **p_ending;
char *str;
char *result; char *result;
char *end = "\r\n"; char *end = "\r\n";
int endlen = 2; int endlen = 2;
long chunklen = 76; long chunklen = 76;
int result_len; int result_len;
int argc = ZEND_NUM_ARGS(); int argc = ZEND_NUM_ARGS();
int str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|ZZ", &p_str, &p_chunklen, &p_ending) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ZZ", &str, &str_len, &p_chunklen, &p_ending) == FAILURE) {
return; return;
} }
convert_to_string_ex(p_str);
if (argc > 1) { if (argc > 1) {
convert_to_long_ex(p_chunklen); convert_to_long_ex(p_chunklen);
chunklen = Z_LVAL_PP(p_chunklen); chunklen = Z_LVAL_PP(p_chunklen);
@ -2115,21 +2094,21 @@ PHP_FUNCTION(chunk_split)
RETURN_FALSE; RETURN_FALSE;
} }
if (chunklen > Z_STRLEN_PP(p_str)) { if (chunklen > str_len) {
/* to maintain BC, we must return original string + ending */ /* 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); result = emalloc(result_len + 1);
memcpy(result, Z_STRVAL_PP(p_str), Z_STRLEN_PP(p_str)); memcpy(result, str, str_len);
memcpy(result + Z_STRLEN_PP(p_str), end, endlen); memcpy(result + str_len, end, endlen);
result[result_len] = '\0'; result[result_len] = '\0';
RETURN_STRINGL(result, result_len, 0); RETURN_STRINGL(result, result_len, 0);
} }
if (!Z_STRLEN_PP(p_str)) { if (!str_len) {
RETURN_EMPTY_STRING(); 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) { if (result) {
RETURN_STRINGL(result, result_len, 0); RETURN_STRINGL(result, result_len, 0);

View file

@ -33,12 +33,12 @@ echo "Done\n";
-- Testing chop() function with Zero arguments -- -- 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 NULL
-- Testing chop() function with more than expected no. of arguments -- -- 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 NULL
string(11) "string_val " string(11) "string_val "
Done Done

View file

@ -138,39 +138,39 @@ string(3) "0.5"
string(2) "0." string(2) "0."
-- Iteration 10 -- -- Iteration 10 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
-- Iteration 11 -- -- Iteration 11 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
-- Iteration 12 -- -- Iteration 12 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
-- Iteration 13 -- -- Iteration 13 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
-- Iteration 14 -- -- Iteration 14 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 1 to be string, array given in %s on line %d
string(5) "Array" NULL
-- Iteration 15 -- -- Iteration 15 --
string(1) "1" string(1) "1"
string(0) "" string(0) ""
@ -205,6 +205,10 @@ string(0) ""
string(16) " @#$%Object @#$%" string(16) " @#$%Object @#$%"
string(11) " @#$%Object" string(11) " @#$%Object"
-- Iteration 26 -- -- 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 Done

View file

@ -128,24 +128,24 @@ string(17) "hello world12345 "
string(17) "hello world12345 " string(17) "hello world12345 "
-- Iteration 10 -- -- Iteration 10 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 2 to be string, array given in %s on line %d
string(17) "hello world12345 " NULL
-- Iteration 11 -- -- Iteration 11 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 2 to be string, array given in %s on line %d
string(17) "hello world12345 " NULL
-- Iteration 12 -- -- Iteration 12 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 2 to be string, array given in %s on line %d
string(17) "hello world12345 " NULL
-- Iteration 13 -- -- Iteration 13 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 2 to be string, array given in %s on line %d
string(17) "hello world12345 " NULL
-- Iteration 14 -- -- Iteration 14 --
Notice: Array to string conversion in %s on line %d Warning: chop() expects parameter 2 to be string, array given in %s on line %d
string(17) "hello world12345 " NULL
-- Iteration 15 -- -- Iteration 15 --
string(17) "hello world12345 " string(17) "hello world12345 "
-- Iteration 16 -- -- Iteration 16 --
@ -165,7 +165,9 @@ string(17) "hello world12345 "
-- Iteration 23 -- -- Iteration 23 --
string(17) "hello world12345 " string(17) "hello world12345 "
-- Iteration 24 -- -- Iteration 24 --
string(%d) "%s"
Warning: chop() expects parameter 2 to be string, resource given in %s on line %d
NULL
-- Iteration 25 -- -- Iteration 25 --
string(17) "hello world12345 " string(17) "hello world12345 "
-- Iteration 26 -- -- Iteration 26 --

View file

@ -118,24 +118,24 @@ string(20) "1. 07 65 43 21 E- 9 "
string(5) "0. 5 " string(5) "0. 5 "
-- Iteration 10 -- -- Iteration 10 --
Notice: Array to string conversion in %s on line 87 Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
string(8) "Ar ra y " NULL
-- Iteration 11 -- -- Iteration 11 --
Notice: Array to string conversion in %s on line 87 Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
string(8) "Ar ra y " NULL
-- Iteration 12 -- -- Iteration 12 --
Notice: Array to string conversion in %s on line 87 Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
string(8) "Ar ra y " NULL
-- Iteration 13 -- -- Iteration 13 --
Notice: Array to string conversion in %s on line 87 Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
string(8) "Ar ra y " NULL
-- Iteration 14 -- -- Iteration 14 --
Notice: Array to string conversion in %s on line 87 Warning: chunk_split() expects parameter 1 to be string, array given in %s on line 87
string(8) "Ar ra y " NULL
-- Iteration 15 -- -- Iteration 15 --
string(1) " " string(1) " "
-- Iteration 16 -- -- Iteration 16 --
@ -163,5 +163,7 @@ string(1) " "
-- Iteration 27 -- -- Iteration 27 --
string(1) " " string(1) " "
-- Iteration 28 -- -- Iteration 28 --
string(%d) "Re so ur ce i d #%s "
Warning: chunk_split() expects parameter 1 to be string, resource given in %s on line 87
NULL
Done Done

View file

@ -17,9 +17,9 @@ echo "Done\n";
--EXPECTF-- --EXPECTF--
*** Testing error conditions *** *** 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 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 NULL
Done Done

View file

@ -501,9 +501,9 @@ array(2) {
*** Testing error conditions *** *** 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 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 NULL
Done Done

View file

@ -35,12 +35,12 @@ echo "Done\n";
-- Testing join() function with Zero arguments -- -- 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 NULL
-- Testing join() function with more than expected no. of arguments -- -- 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 NULL
-- Testing join() with less than expected no. of arguments -- -- Testing join() with less than expected no. of arguments --

View file

@ -52,12 +52,12 @@ echo "\nDone\n";
*** Output for zero argument *** *** 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 NULL
*** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** *** 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 NULL
*** Using heredoc string *** *** Using heredoc string ***

View file

@ -27,14 +27,14 @@ echo "*** Done ***";
*** Testing strrchr() function: error conditions *** *** Testing strrchr() function: error conditions ***
-- Testing strrchr() function with Zero arguments -- -- 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 NULL
-- Testing strrchr() function with less than expected no. of arguments -- -- 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 NULL
-- Testing strrchr() function with more than expected no. of arguments -- -- 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 NULL
*** Done *** *** Done ***

View file

@ -110,24 +110,24 @@ bool(false)
bool(false) bool(false)
-- Iteration 10 -- -- Iteration 10 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
bool(false) NULL
-- Iteration 11 -- -- Iteration 11 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
bool(false) NULL
-- Iteration 12 -- -- Iteration 12 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
bool(false) NULL
-- Iteration 13 -- -- Iteration 13 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
bool(false) NULL
-- Iteration 14 -- -- Iteration 14 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
bool(false) NULL
-- Iteration 15 -- -- Iteration 15 --
bool(false) bool(false)
-- Iteration 16 -- -- Iteration 16 --
@ -149,7 +149,9 @@ bool(false)
-- Iteration 23 -- -- Iteration 23 --
bool(false) bool(false)
-- Iteration 24 -- -- Iteration 24 --
%s
Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
NULL
-- Iteration 25 -- -- Iteration 25 --
bool(false) bool(false)
-- Iteration 26 -- -- Iteration 26 --

View file

@ -151,24 +151,24 @@ string(7) "1.06E-9"
string(2) ".5" string(2) ".5"
-- Iteration 10 -- -- Iteration 10 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
string(2) "ay" NULL
-- Iteration 11 -- -- Iteration 11 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
string(2) "ay" NULL
-- Iteration 12 -- -- Iteration 12 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
string(3) "ray" NULL
-- Iteration 13 -- -- Iteration 13 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
string(1) "y" NULL
-- Iteration 14 -- -- Iteration 14 --
Notice: Array to string conversion in %s on line %d Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
string(2) "ay" NULL
-- Iteration 15 -- -- Iteration 15 --
bool(false) bool(false)
-- Iteration 16 -- -- Iteration 16 --
@ -188,7 +188,9 @@ bool(false)
-- Iteration 23 -- -- Iteration 23 --
bool(false) bool(false)
-- Iteration 24 -- -- Iteration 24 --
bool(false)
Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
NULL
-- Iteration 25 -- -- Iteration 25 --
bool(false) bool(false)
-- Iteration 26 -- -- Iteration 26 --