Skip to content

Commit 82fc47e

Browse files
author
Rui Hirokawa
committed
MFH: fixed #28899 mb_substr() and substr() work differently when mbstring.func_overload is enabled.
1 parent bb16adb commit 82fc47e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/mbstring/mbstring.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,11 @@ PHP_FUNCTION(mb_substr)
17361736
}
17371737
}
17381738

1739+
if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING)
1740+
&& (from >= mbfl_strlen(&string))) {
1741+
RETURN_FALSE;
1742+
}
1743+
17391744
ret = mbfl_substr(&string, &result, from, len);
17401745
if (ret != NULL) {
17411746
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */

0 commit comments

Comments
 (0)