Skip to content

Commit 8dfcb6d

Browse files
committed
Allow empty needle in mb_str(i)pos
1 parent 1d69bf1 commit 8dfcb6d

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

ext/mbstring/mbstring.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,11 +2110,6 @@ PHP_FUNCTION(mb_strpos)
21102110
}
21112111
}
21122112

2113-
if (needle.len == 0) {
2114-
php_error_docref(NULL, E_WARNING, "Empty delimiter");
2115-
RETURN_FALSE;
2116-
}
2117-
21182113
n = mbfl_strpos(&haystack, &needle, offset, reverse);
21192114
if (!mbfl_is_error(n)) {
21202115
RETVAL_LONG(n);
@@ -2222,11 +2217,6 @@ PHP_FUNCTION(mb_stripos)
22222217
return;
22232218
}
22242219

2225-
if (needle.len == 0) {
2226-
php_error_docref(NULL, E_WARNING, "Empty delimiter");
2227-
RETURN_FALSE;
2228-
}
2229-
22302220
n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding);
22312221

22322222
if (!mbfl_is_error(n)) {
@@ -2279,11 +2269,6 @@ PHP_FUNCTION(mb_strstr)
22792269
RETURN_FALSE;
22802270
}
22812271

2282-
if (needle.len == 0) {
2283-
php_error_docref(NULL, E_WARNING, "Empty delimiter");
2284-
RETURN_FALSE;
2285-
}
2286-
22872272
n = mbfl_strpos(&haystack, &needle, 0, 0);
22882273
if (!mbfl_is_error(n)) {
22892274
if (part) {
@@ -2383,11 +2368,6 @@ PHP_FUNCTION(mb_stristr)
23832368
RETURN_FALSE;
23842369
}
23852370

2386-
if (!needle.len) {
2387-
php_error_docref(NULL, E_WARNING, "Empty delimiter");
2388-
RETURN_FALSE;
2389-
}
2390-
23912371
n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, from_encoding);
23922372
if (mbfl_is_error(n)) {
23932373
RETURN_FALSE;

0 commit comments

Comments
 (0)