bug30578.phpt 566 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #30578 (Output buffers flushed before calling __destruct functions)
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. class Example
  7. {
  8. function __construct()
  9. {
  10. ob_start();
  11. echo "This should be displayed last.\n";
  12. }
  13. function __destruct()
  14. {
  15. $buffered_data = ob_get_contents();
  16. ob_end_clean();
  17. echo "This should be displayed first.\n";
  18. echo "Buffered data: $buffered_data";
  19. }
  20. }
  21. $obj = new Example;
  22. ?>
  23. --EXPECT--
  24. This should be displayed first.
  25. Buffered data: This should be displayed last.