mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
This commit is contained in:
commit
1f0ffece91
2 changed files with 19 additions and 0 deletions
|
@ -3052,6 +3052,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