Skip to content

Commit 192847c

Browse files
manuelmDanielEScherzer
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 (cherry picked from commit 37e82ea)
1 parent de8cd45 commit 192847c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.5.0RC5
44

5+
- Core:
6+
. Fixed bug GH-17951 (memory_limit is not always limited by max_memory_limit).
7+
(manuelm)
58

69
06 Nov 2025, PHP 8.5.0RC4
710

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)