1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

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
This commit is contained in:
manuel
2025-09-24 16:36:47 +02:00
committed by Ilija Tovilo
parent 5087cf3001
commit 37e82ea5d0
2 changed files with 21 additions and 0 deletions

2
NEWS
View File

@@ -6,6 +6,8 @@ PHP NEWS
. Sync all boost.context files with release 1.86.0. (mvorisek)
. Fixed bug GH-20435 (SensitiveParameter doesn't work for named argument
passing to variadic parameter). (ndossche)
. Fixed bug GH-17951 (memory_limit is not always limited by max_memory_limit).
(manuelm)
- Standard:
. Fix memory leak in array_diff() with custom type checks. (ndossche)

View File

@@ -0,0 +1,19 @@
--TEST--
GH-17951 Runtime Change 6
--INI--
memory_limit=128M
max_memory_limit=512M
--FILE--
<?php
for($i = 0; $i < 3; $i++) {
ini_set('memory_limit', '1024M');
echo ini_get('memory_limit');
}
?>
--EXPECTF--
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
512M
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
512M
Warning: Failed to set memory_limit to 1073741824 bytes. Setting to max_memory_limit instead (currently: 536870912 bytes) in %s on line %d
512M