Skip to content

Commit 6cf76d5

Browse files
committed
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.
1 parent b140f6e commit 6cf76d5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

sapi/cli/tests/bug80092.phpt

+12-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ $cmd = [
2525
];
2626

2727
$proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
28-
echo stream_get_contents($pipes[1]);
28+
$output = stream_get_contents($pipes[1]);
29+
30+
// Ignore warnings if opcache loads twice or duplicate modules are loaded by searching for the preloaded marker
31+
$flag = false;
32+
foreach (explode("\n", $output) as $line) {
33+
if ($line === "preloaded") {
34+
$flag = true;
35+
}
36+
if ($flag) {
37+
echo $line, "\n";
38+
}
39+
}
2940

3041
?>
3142
--EXPECTF--
32-
%A
3343
preloaded
3444
PHP %s
3545
Copyright (c) The PHP Group

0 commit comments

Comments
 (0)