diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/standard/string.c | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -70,6 +70,8 @@ PHP NEWS - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory already exists). (Pierre) +- Fixed bug #42142 (substr_replace() returns FALSE when length > string + length). (Ilia) - Fixed bug #42135 (Second call of session_start() causes creation of SID). (Ilia) - Fixed Bug #42112 (deleting a node produces memory corruption). (Rob) diff --git a/ext/standard/string.c b/ext/standard/string.c index 4436b5a7aa..2617c681b3 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2226,7 +2226,7 @@ PHP_FUNCTION(substr_replace) if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) { RETURN_FALSE; } else if (l > Z_STRLEN_PP(str) || (l < 0 && -l > Z_STRLEN_PP(str))) { - RETURN_FALSE; + l = Z_STRLEN_PP(str); } if ((f + l) > Z_STRLEN_PP(str)) { |