summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--ext/standard/string.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 3eae7a5ab0..054d8cc093 100644
--- a/NEWS
+++ b/NEWS
@@ -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)) {