From 6cf76d552e5bcfda15aaf665cd3dd407c972e844 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:53:38 +0200 Subject: [PATCH] Ignore optional warning output in test Due to the greedy behaviour of regex, we can't seem to use %A? Use a for loop with a marker instead to ignore module startup warnings. --- sapi/cli/tests/bug80092.phpt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sapi/cli/tests/bug80092.phpt b/sapi/cli/tests/bug80092.phpt index 8e77602a478..32e76c41e67 100644 --- a/sapi/cli/tests/bug80092.phpt +++ b/sapi/cli/tests/bug80092.phpt @@ -25,11 +25,21 @@ $cmd = [ ]; $proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes); -echo stream_get_contents($pipes[1]); +$output = stream_get_contents($pipes[1]); + +// Ignore warnings if opcache loads twice or duplicate modules are loaded by searching for the preloaded marker +$flag = false; +foreach (explode("\n", $output) as $line) { + if ($line === "preloaded") { + $flag = true; + } + if ($flag) { + echo $line, "\n"; + } +} ?> --EXPECTF-- -%A preloaded PHP %s Copyright (c) The PHP Group