php-src/tests/lang/bug45392.phpt
Nikita Popov e9b005158f Fix output buffer discard on memory limit
Move this code directly into the error handler, and check the
heap->overflow flag. Discarding output here allows us to print
the normal memory limit message to standard output. Otherwise
nothing would be printed unless a different log medium was used,
which makes for a suboptimal debugging experience.
2021-05-31 16:30:36 +02:00

23 lines
409 B
PHP

--TEST--
Bug #45392 (ob_start()/ob_end_clean() and memory_limit)
--SKIPIF--
<?php
if (getenv("USE_ZEND_ALLOC") === "0") {
die("skip Zend MM disabled");
}
--FILE--
<?php
echo __LINE__ . "\n";
ini_set('memory_limit', "2M");
ob_start();
$i = 0;
while($i++ < 5000) {
echo str_repeat("may not be displayed ", 42);
}
ob_end_clean();
?>
--EXPECTF--
2
Fatal error: Allowed memory size of %d bytes exhausted%s