diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-29 10:02:03 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-29 11:10:47 +0100 |
commit | c97b9aa2266736beb1ddb6fec0ec2d2af94e3a6c (patch) | |
tree | abb5fb218cea30e97b660025cad06c651a95dd5a | |
parent | c7d7af8069246c886606501e30e6e8741e6683c2 (diff) | |
download | php-git-c97b9aa2266736beb1ddb6fec0ec2d2af94e3a6c.tar.gz |
Always treat needles as strings
This is part of https://wiki.php.net/rfc/deprecations_php_7_3.
31 files changed, 208 insertions, 1073 deletions
@@ -76,6 +76,11 @@ PHP 8.0 UPGRADE NOTES . parse_str() can no longer be used without specifying a result array. . fgetss() has been removed. . The string.strip_tags filter has been removed. + . The needle argument of strpos(), strrpos(), stripos(), strripos(), strstr(), + strchr(), strrchr(), and stristr() will now always be interpreted as a + string. Previously non-string needles were interpreted as an ASCII code + point. An explicit call to chr() can be used to restore the previous + behavior. - Zlib: . gzgetss() has been removed. diff --git a/ext/standard/string.c b/ext/standard/string.c index 068c6e82c4..18ca7e9947 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1813,79 +1813,34 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) } /* }}} */ -/* {{{ php_needle_char - */ -static int php_needle_char(zval *needle, char *target) -{ - switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); - return SUCCESS; - case IS_NULL: - case IS_FALSE: - *target = '\0'; - return SUCCESS; - case IS_TRUE: - *target = '\1'; - return SUCCESS; - case IS_DOUBLE: - *target = (char)(int)Z_DVAL_P(needle); - return SUCCESS; - case IS_OBJECT: - *target = (char) zval_get_long(needle); - return SUCCESS; - default: - php_error_docref(NULL, E_WARNING, "needle is not a string or an integer"); - return FAILURE; - } -} -/* }}} */ - /* {{{ proto string stristr(string haystack, string needle[, bool part]) Finds first occurrence of a string within another, case insensitive */ PHP_FUNCTION(stristr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; size_t found_offset; char *haystack_dup; - char needle_char[2]; + char *orig_needle; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); - - if (Z_TYPE_P(needle) == IS_STRING) { - char *orig_needle; - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - efree(haystack_dup); - RETURN_FALSE; - } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle)); - efree(orig_needle); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - efree(haystack_dup); - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); + orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle)); + found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle)); + efree(orig_needle); + if (found) { found_offset = found - haystack_dup; if (part) { @@ -1905,40 +1860,25 @@ PHP_FUNCTION(stristr) Finds first occurrence of a string within another */ PHP_FUNCTION(strstr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; zend_long found_offset; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { found_offset = found - ZSTR_VAL(haystack); if (part) { @@ -1959,15 +1899,13 @@ PHP_FUNCTION(strstr) Finds position of first occurrence of a string within another */ PHP_FUNCTION(strpos) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; - zend_long offset = 0; + zend_long offset = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -1980,32 +1918,15 @@ PHP_FUNCTION(strpos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - Z_STRVAL_P(needle), - Z_STRLEN_P(needle), - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - needle_char, - 1, - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, + ZSTR_VAL(needle), ZSTR_LEN(needle), + ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { RETURN_LONG(found - ZSTR_VAL(haystack)); } else { @@ -2019,15 +1940,13 @@ PHP_FUNCTION(strpos) PHP_FUNCTION(stripos) { const char *found = NULL; - zend_string *haystack; + zend_string *haystack, *needle; zend_long offset = 0; - char needle_char[2]; - zval *needle; zend_string *needle_dup = NULL, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -2044,33 +1963,14 @@ PHP_FUNCTION(stripos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) { - RETURN_FALSE; - } - - haystack_dup = php_string_tolower(haystack); - needle_dup = php_string_tolower(Z_STR_P(needle)); - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - haystack_dup = php_string_tolower(haystack); - needle_char[0] = tolower(needle_char[0]); - needle_char[1] = '\0'; - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - needle_char, - sizeof(needle_char) - 1, - ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); + if (ZSTR_LEN(needle) == 0 || ZSTR_LEN(needle) > ZSTR_LEN(haystack)) { + RETURN_FALSE; } + haystack_dup = php_string_tolower(haystack); + needle_dup = php_string_tolower(needle); + found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, + ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); if (found) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); @@ -2089,38 +1989,20 @@ PHP_FUNCTION(stripos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strrpos) { - zval *zneedle; zend_string *haystack; + char *needle; size_t needle_len; zend_long offset = 0; - char ord_needle[2]; - const char *p, *e, *found, *needle; + const char *p, *e, *found; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STRING(needle, needle_len) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); - } else { - if (php_needle_char(zneedle, ord_needle) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ord_needle[1] = '\0'; - needle = ord_needle; - needle_len = 1; - } - - if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) { + if (ZSTR_LEN(haystack) == 0 || needle_len == 0) { RETURN_FALSE; } @@ -2156,49 +2038,29 @@ PHP_FUNCTION(strrpos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strripos) { - zval *zneedle; zend_string *needle; zend_string *haystack; zend_long offset = 0; const char *p, *e, *found; - zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; - ALLOCA_FLAG(use_heap); + zend_string *needle_dup, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STR_P(zneedle); - } else { - if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ZSTR_VAL(ord_needle)[1] = '\0'; - needle = ord_needle; - } - - if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (ZSTR_LEN(haystack) == 0 || ZSTR_LEN(needle) == 0) { RETURN_FALSE; } if (ZSTR_LEN(needle) == 1) { /* Single character search can shortcut memcmps Can also avoid tolower emallocs */ + char lowered; if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2207,22 +2069,19 @@ PHP_FUNCTION(strripos) } else { p = ZSTR_VAL(haystack); if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + (size_t)offset; } /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ - *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle)); + lowered = tolower(*ZSTR_VAL(needle)); while (e >= p) { - if (tolower(*e) == *ZSTR_VAL(ord_needle)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (tolower(*e) == lowered) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2230,7 +2089,6 @@ PHP_FUNCTION(strripos) if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2239,7 +2097,6 @@ PHP_FUNCTION(strripos) } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2256,11 +2113,9 @@ PHP_FUNCTION(strripos) RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } } @@ -2270,31 +2125,16 @@ PHP_FUNCTION(strripos) Finds the last occurrence of a character in a string within another */ PHP_FUNCTION(strrchr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; zend_long found_offset; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack)); - } else { - char needle_chr; - if (php_needle_char(needle, &needle_chr) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack)); - } - + found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack)); if (found) { found_offset = found - ZSTR_VAL(haystack); RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset); diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index 057b8ca494..4c3c5a7fcc 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -28,7 +28,7 @@ stripos() function test echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(0) int(5) int(5) @@ -45,23 +45,11 @@ int(0) bool(false) bool(false) bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) +int(0) int(1) Done diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index a3fc324dd7..53d6be65e7 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with double quoted strings *** -- Iteration 1 -- int(2) @@ -117,32 +117,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81b8f5adb1..81d3b35a20 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -95,101 +95,71 @@ echo "*** Done ***"; *** Testing stripos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(7) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(16) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(17) -- Iteration 10 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stripos() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 11 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stripos() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 12 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stripos() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 13 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stripos() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 14 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stripos() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 16 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 18 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) @@ -198,27 +168,19 @@ bool(false) bool(false) -- Iteration 22 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 24 -- -Warning: stripos(): needle is not a string or an integer in %s on line %d -%s +Warning: stripos() expects parameter 2 to be string, resource given in %s on line %d +NULL -- Iteration 25 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index b4b83a1641..1f79b61d1a 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -91,67 +91,31 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 10 -- @@ -189,11 +153,7 @@ NULL Warning: stripos() expects parameter 1 to be string, array given in %s on line %d NULL -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 16 -- bool(false) @@ -201,11 +161,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 18 -- bool(false) @@ -213,15 +169,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation15.phpt b/ext/standard/tests/strings/stripos_variation15.phpt index f8d4f029fe..4d4b6396b9 100644 --- a/ext/standard/tests/strings/stripos_variation15.phpt +++ b/ext/standard/tests/strings/stripos_variation15.phpt @@ -91,12 +91,8 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function with unexpected values for haystack, needle & offset *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 3 -- @@ -119,13 +115,9 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 10 -- Warning: stripos() expects parameter 1 to be string, array given in %s on line %d @@ -147,14 +139,10 @@ NULL Warning: stripos() expects parameter 1 to be string, array given in %s on line %d NULL -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 16 -- bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 18 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index bb77d1becb..0f4c887869 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with single quoted strings *** -- Iteration 1 -- int(2) @@ -119,32 +119,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -234,11 +218,7 @@ bool(false) bool(false) bool(false) -- Iteration 45 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(26) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 46 -- int(0) diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index 8fca54b082..a0f0cc3497 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -25,8 +25,8 @@ NULL Warning: stristr() expects parameter 1 to be string, array given in %s on line %d NULL -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stristr() expects parameter 2 to be string, array given in %s on line %d +NULL Warning: stristr() expects parameter 1 to be string, array given in %s on line %d NULL diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt index b899b4739d..ae2c8e93cf 100644 --- a/ext/standard/tests/strings/stristr2.phpt +++ b/ext/standard/tests/strings/stristr2.phpt @@ -16,14 +16,10 @@ var_dump(stristr($email, 97)); var_dump(stristr($email, 97, 1)); ?> ---EXPECTF-- +--EXPECT-- string(7) "cCdEfGh" string(2) "Ab" string(5) "eEfGh" string(4) "AbCd" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(11) "azAbCdeEfGh" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(1) "w" +bool(false) +bool(false) diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 4a0b62f261..8ca09db66c 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -83,85 +83,63 @@ fclose($file_handle); //closing the file handle --EXPECTF-- *** Testing stristr() function: with unexpected inputs for 'needle' argument *** -- Iteration 1 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 2 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 3 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 6 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 7 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stristr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 9 -- -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stristr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 10 -- -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stristr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 11 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 12 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 15 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 16 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 17 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 18 -- -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: stristr() expects parameter 2 to be string, resource given in %s on line %d +NULL -- Iteration 19 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 20 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 578539804d..a4c3a9c781 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt index fd045c64d3..76cf8e59ef 100644 --- a/ext/standard/tests/strings/strpos_number.phpt +++ b/ext/standard/tests/strings/strpos_number.phpt @@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111)); // string("11") is contained var_dump(strpos("foo 11", "11")); ?> ---EXPECTF-- -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +--EXPECT-- +int(4) bool(false) - -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(1) int(4) diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt Binary files differindex 5043128945..a75dd96bbf 100644 --- a/ext/standard/tests/strings/strrchr_variation1.phpt +++ b/ext/standard/tests/strings/strrchr_variation1.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 3b06b20be1..478ac80300 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -132,105 +132,67 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "-2" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 10 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 11 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 12 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 13 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 14 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, array given in %s on line %d +NULL -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 20 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 21 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 22 -- bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +Warning: strrchr() expects parameter 2 to be string, resource given in %s on line %d +NULL -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 108ba2e0f2..92a9c07eee 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -91,41 +91,23 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "12345" -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-2345" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(10) "1234567000" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "1E-9" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(3) "0.5" -- Iteration 10 -- Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d @@ -147,49 +129,29 @@ NULL Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d NULL -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d NULL -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt Binary files differindex 730811ea47..a17902604a 100644 --- a/ext/standard/tests/strings/strrchr_variation12.phpt +++ b/ext/standard/tests/strings/strrchr_variation12.phpt diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt index ddce2c2ccb..2ff6720fb9 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -117,23 +117,15 @@ bool(false) string(5) "\101 " -- Iteration 12 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- @@ -221,9 +213,7 @@ bool(false) string(7) "4 \101 " -- Iteration 44 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(7) "4 \101 " -- Iteration 45 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt index 6b49b698f4..31a727ed6f 100644 --- a/ext/standard/tests/strings/strrchr_variation8.phpt +++ b/ext/standard/tests/strings/strrchr_variation8.phpt @@ -30,15 +30,11 @@ foreach($needles as $needle) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with heredoc strings *** bool(false) bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 70a9534ebd..b5d09d7946 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -31,16 +31,12 @@ bool(false) Warning: strripos() expects parameter 1 to be string, array given in %s on line %d bool(false) -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 59d7a64686..ce396695af 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -74,7 +74,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -132,57 +132,25 @@ int(8) bool(false) int(8) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 16 -- bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 7b47b787be..3800c32155 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -75,7 +75,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -133,56 +133,24 @@ int(10) bool(false) int(10) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -280,18 +248,10 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) +bool(false) +bool(false) +bool(false) +bool(false) -- Iteration 36 -- int(0) bool(false) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 9ef4f42d18..1399b60985 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -27,16 +27,12 @@ bool(false) Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d bool(false) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt index fd236d04d4..4fc480face 100644 --- a/ext/standard/tests/strings/strrpos_variation1.phpt +++ b/ext/standard/tests/strings/strrpos_variation1.phpt @@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -108,32 +108,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b9b24b9cb1..b374e7f9f6 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -94,105 +94,67 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(42) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(27) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(28) -- Iteration 10 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d bool(false) -- Iteration 11 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d bool(false) -- Iteration 12 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d bool(false) -- Iteration 13 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d bool(false) -- Iteration 14 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, array given in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- -Warning: strrpos(): needle is not a string or an integer in %s on line %d +Warning: strrpos() expects parameter 2 to be string, resource given in %s on line %d bool(false) -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index 94c1b9d96d..f628427f08 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -91,67 +91,31 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 10 -- @@ -189,43 +153,19 @@ bool(false) Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) @@ -234,18 +174,10 @@ bool(false) bool(false) bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- @@ -255,17 +187,9 @@ bool(false) Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d bool(false) -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt deleted file mode 100644 index 798a6877e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation15.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */ - -echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** --- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index 9c0a320785..af5c9e349d 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -109,32 +109,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -194,11 +178,7 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 36 -- int(0) diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 54db4b372e..c0546c74f8 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -22,15 +22,11 @@ var_dump( strrpos($empty_string, NULL) ); echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with heredoc strings *** -- With empty heredoc string -- bool(false) bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex 2908de7a27..cc3b7c5453 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt index bf1fb67711..6d0a9d12b9 100644 --- a/tests/strings/001.phpt +++ b/tests/strings/001.phpt @@ -3,8 +3,6 @@ String functions --FILE-- <?php -error_reporting(0); - echo "Testing strtok: "; $str = "testing 1/2\\3"; @@ -26,7 +24,7 @@ if ($tok1 != "testing") { echo "Testing strstr: "; $test = "This is a test"; -$found1 = strstr($test, 32); +$found1 = strstr($test, chr(32)); $found2 = strstr($test, "a "); if ($found1 != " is a test") { echo("failed 1\n"); @@ -39,7 +37,7 @@ if ($found1 != " is a test") { echo "Testing strrchr: "; $test = "fola fola blakken"; $found1 = strrchr($test, "b"); -$found2 = strrchr($test, 102); +$found2 = strrchr($test, chr(102)); if ($found1 != "blakken") { echo("failed 1\n"); } elseif ($found2 != "fola blakken") { |