xref: /PHP-8.0/tests/output/bug46897.phpt (revision d1764ca3)
1--TEST--
2Bug #46897: ob_flush() should fail to flush unerasable buffers
3--FILE--
4<?php
5function callback($string) {
6    static $callback_invocations;
7    $callback_invocations++;
8    return "[callback:$callback_invocations]$string\n";
9}
10
11ob_start('callback', 0, false);
12
13echo "Attempt to flush unerasable buffer - should fail...";
14var_dump(ob_flush());
15// Check content of buffer after flush - if flush failed it should still contain the string above.
16var_dump(ob_get_contents());
17echo 'Done';
18?>
19--EXPECTF--
20[callback:1]Attempt to flush unerasable buffer - should fail...
21Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line %d
22bool(false)
23string(%d) "Attempt to flush unerasable buffer - should fail...
24Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line %d
25bool(false)
26"
27Done
28