Skip to content

Commit 462fcad

Browse files
committed
Avoid huge output in gh20840.phpt
This can trigger the memory limit in run-tests.php, which buffers the tests output. Instead, only output "nesting level too deep" and discard the rest. Closes phpGH-20946
1 parent 27ed48c commit 462fcad

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ext/standard/tests/general_functions/gh20840.phpt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ for ($i = 0; $i < 50000; $i++) {
2828
$node = $newNode;
2929
}
3030

31+
$buffer = '';
32+
ob_start(function ($chunk) use (&$buffer) {
33+
$buffer .= $chunk;
34+
$buffer = preg_replace('(\s*object\(Node\)#\d+ \(\d+\) \{\s*)', '', $buffer);
35+
$buffer = preg_replace('(\s*\["next"\]=>\s*)', '', $buffer);
36+
$buffer = preg_replace('(\s*\}\s*)', '', $buffer);
37+
});
3138
var_dump($firstNode);
39+
ob_end_flush();
40+
echo $buffer;
3241

3342
while ($next = $firstNode->next) {
3443
$firstNode->next = $next->next;
3544
}
3645
?>
37-
--EXPECTREGEX--
38-
^object\(Node\)#\d+ \(\d+\).*(nesting level too deep|["\s}]*)$
46+
--EXPECT--
47+
nesting level too deep

0 commit comments

Comments
 (0)