From 19c0deba73c681ef80b0e26463366e98c511dcc1 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 21 Oct 2026 18:05:32 +0200 Subject: [PATCH] ext/filter: make sure filter.so is loaded when invoking PHP inside a phpt test The test-suite uses `-d extension_dir=...` & `-d extension=...` to make sure the correct extension is loaded, when compiling into a shared-object (e.g. what's happening with `--disable-all`). This change also introduces this behavior for the new regression tests. This in fact bit the nixpkgs build while updating to the earlier-released patches since we have split off most extension builds from core. --- .../tests/oom_filter_default_encoded.phpt | 11 +++++++++++ ext/filter/tests/oom_filter_input.phpt | 17 ++++++++++++++++- ext/filter/tests/oom_filter_input_array.phpt | 17 ++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/ext/filter/tests/oom_filter_default_encoded.phpt b/ext/filter/tests/oom_filter_default_encoded.phpt index 4e81326639a0..c9a33090455b 100644 --- a/ext/filter/tests/oom_filter_default_encoded.phpt +++ b/ext/filter/tests/oom_filter_default_encoded.phpt @@ -26,6 +26,17 @@ function oom_post_encoded(string $body, string $script): void '-d', 'html_errors=0', '-d', 'filter.default=encoded', '-d', 'filter.default_flags=0', + ...((function () { + $extDir = ini_get("extension_dir"); + if (file_exists($extDir."/filter.so")) { + return [ + '-d', sprintf("extension_dir=%s", ini_get('extension_dir')), + '-d', 'extension=filter.so', + ]; + } else { + return []; + } + })()), /* the conversion is what is under test, not the deprecation */ '-d', 'error_reporting=' . (E_ALL & ~E_DEPRECATED), ], diff --git a/ext/filter/tests/oom_filter_input.phpt b/ext/filter/tests/oom_filter_input.phpt index aef71dff563c..6fc138bedec7 100644 --- a/ext/filter/tests/oom_filter_input.phpt +++ b/ext/filter/tests/oom_filter_input.phpt @@ -23,7 +23,22 @@ $body = "--$boundary\r\nContent-Disposition: form-data; name=\"k\"\r\n\r\n" . "\r\n--$boundary--\r\n"; $p = proc_open( - [getenv('TEST_PHP_CGI_EXECUTABLE'), '-n', '-d', 'memory_limit=12M', '-d', 'html_errors=0'], + [ + getenv('TEST_PHP_CGI_EXECUTABLE'), '-n', + '-d', 'memory_limit=12M', + '-d', 'html_errors=0', + ...((function () { + $extDir = ini_get("extension_dir"); + if (file_exists($extDir."/filter.so")) { + return [ + '-d', sprintf("extension_dir=%s", ini_get('extension_dir')), + '-d', 'extension=filter.so', + ]; + } else { + return []; + } + })()), + ], [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, null, diff --git a/ext/filter/tests/oom_filter_input_array.phpt b/ext/filter/tests/oom_filter_input_array.phpt index a8e2712271c6..dfb82b84541d 100644 --- a/ext/filter/tests/oom_filter_input_array.phpt +++ b/ext/filter/tests/oom_filter_input_array.phpt @@ -23,7 +23,22 @@ $body = "--$boundary\r\nContent-Disposition: form-data; name=\"k\"\r\n\r\n" . "\r\n--$boundary--\r\n"; $p = proc_open( - [getenv('TEST_PHP_CGI_EXECUTABLE'), '-n', '-d', 'memory_limit=12M', '-d', 'html_errors=0'], + [ + getenv('TEST_PHP_CGI_EXECUTABLE'), '-n', + '-d', 'memory_limit=12M', + '-d', 'html_errors=0', + ...((function () { + $extDir = ini_get("extension_dir"); + if (file_exists($extDir."/filter.so")) { + return [ + '-d', sprintf("extension_dir=%s", ini_get('extension_dir')), + '-d', 'extension=filter.so', + ]; + } else { + return []; + } + })()), + ], [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes, null,