mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.4'
This commit is contained in:
commit
c0a54f41b3
2 changed files with 19 additions and 0 deletions
|
@ -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) {
|
||||
|
|
18
ext/standard/tests/strings/bug78612.phpt
Normal file
18
ext/standard/tests/strings/bug78612.phpt
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue