Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-09-30 15:06:51 +02:00
commit c0a54f41b3
2 changed files with 19 additions and 0 deletions

View file

@ -2847,6 +2847,7 @@ static void php_strtr_array(zval *return_value, zend_string *input, HashTable *p
len = ZSTR_LEN(key_used);
if (UNEXPECTED(len > slen)) {
/* skip long patterns */
zend_string_release(key_used);
continue;
}
if (len > maxlen) {

View file

@ -0,0 +1,18 @@
--TEST--
Bug #78612 (strtr leaks memory when integer keys are used and the subject string shorter).
--FILE--
<?php
$find_replace = array();
$_a = 7111222333000001;
$_b = 5000001;
for ($j=0; $j<10; $j++) {
$find_replace[$_a + $j] = $_b + $j;
}
echo strtr('Hello', $find_replace), "\n";
?>
--EXPECT--
Hello