1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

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 GH-20946
This commit is contained in:
Ilija Tovilo
2026-01-15 23:46:41 +01:00
parent 27ed48c0be
commit 462fcad419

View File

@@ -28,11 +28,20 @@ for ($i = 0; $i < 50000; $i++) {
$node = $newNode;
}
$buffer = '';
ob_start(function ($chunk) use (&$buffer) {
$buffer .= $chunk;
$buffer = preg_replace('(\s*object\(Node\)#\d+ \(\d+\) \{\s*)', '', $buffer);
$buffer = preg_replace('(\s*\["next"\]=>\s*)', '', $buffer);
$buffer = preg_replace('(\s*\}\s*)', '', $buffer);
});
var_dump($firstNode);
ob_end_flush();
echo $buffer;
while ($next = $firstNode->next) {
$firstNode->next = $next->next;
}
?>
--EXPECTREGEX--
^object\(Node\)#\d+ \(\d+\).*(nesting level too deep|["\s}]*)$
--EXPECT--
nesting level too deep