From 37e82ea5d0da3a21d58e28ad28d29f704b1fb797 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 24 Sep 2025 16:36:47 +0200 Subject: [PATCH] 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 --- NEWS | 2 ++ tests/basic/gh17951_runtime_change_6.phpt | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/basic/gh17951_runtime_change_6.phpt diff --git a/NEWS b/NEWS index 5cda4161ea7..4ff3472d926 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/tests/basic/gh17951_runtime_change_6.phpt b/tests/basic/gh17951_runtime_change_6.phpt new file mode 100644 index 00000000000..0c62b0e8374 --- /dev/null +++ b/tests/basic/gh17951_runtime_change_6.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-17951 Runtime Change 6 +--INI-- +memory_limit=128M +max_memory_limit=512M +--FILE-- + +--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