Skip to content

Commit 37e82ea

Browse files
manuelmiluuu1994
authored andcommitted
memory_limit is not always limited by max_memory_limit
Make sure to always duplicate max_memory_limit ini value. Otherwise the alter ini routine may assume the value hasn't been overwritten, resulting in the user-specified value being set after the on_modify handler has run. Fixes GH-17951 Closes GH-19963
1 parent 5087cf3 commit 37e82ea

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ PHP NEWS
66
. Sync all boost.context files with release 1.86.0. (mvorisek)
77
. Fixed bug GH-20435 (SensitiveParameter doesn't work for named argument
88
passing to variadic parameter). (ndossche)
9+
. Fixed bug GH-17951 (memory_limit is not always limited by max_memory_limit).
10+
(manuelm)
911

1012
- Standard:
1113
. Fix memory leak in array_diff() with custom type checks. (ndossche)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-17951 Runtime Change 6
3+
--INI--
4+
memory_limit=128M
5+
max_memory_limit=512M
6+
--FILE--
7+
<?php
8+
for($i = 0; $i < 3; $i++) {
9+
ini_set('memory_limit', '1024M');
10+
echo ini_get('memory_limit');
11+
}
12+
?>
13+
--EXPECTF--
14+
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
15+
512M
16+
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
17+
512M
18+
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
19+
512M

0 commit comments

Comments
 (0)