This is part of https://wiki.php.net/rfc/deprecations_php_7_3.
. 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.
}
/* }}} */
-/* {{{ 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) {
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) {
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();
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 {
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();
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));
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;
}
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;
}
} 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;
}
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;
}
} 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;
}
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;
}
}
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);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(0)
int(5)
int(5)
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
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with double quoted strings ***
-- Iteration 1 --
int(2)
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)
*** 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)
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 ***
--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 --
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)
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)
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)
--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 --
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
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)
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with single quoted strings ***
-- Iteration 1 --
int(2)
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)
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)
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
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)
--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===
// 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)
--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 ***
--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
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 ***
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 --
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 "
}
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)
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)
}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
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)
}
?>
===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
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)
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)
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)
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
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)
--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 ***
--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 --
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)
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 --
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 ***
+++ /dev/null
---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 ***
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
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)
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)
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 ***
--FILE--
<?php
-error_reporting(0);
-
echo "Testing strtok: ";
$str = "testing 1/2\\3";
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");
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") {