ob_start_basic_unerasable_005.phpt 802 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush()
  3. --FILE--
  4. <?php
  5. function callback($string) {
  6. static $callback_invocations;
  7. $callback_invocations++;
  8. return "[callback:$callback_invocations]$string\n";
  9. }
  10. ob_start('callback', 0, false);
  11. echo "Attempt to flush unerasable buffer - should fail... ";
  12. var_dump(ob_flush());
  13. // Check content of buffer after flush - if flush failed it should still contain the string above.
  14. var_dump(ob_get_contents());
  15. ?>
  16. --EXPECTF--
  17. [callback:1]Attempt to flush unerasable buffer - should fail...
  18. Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
  19. bool(false)
  20. string(%d) "Attempt to flush unerasable buffer - should fail...
  21. Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
  22. bool(false)
  23. "