bug64960.phpt 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Bug #64960 (Segfault in gc_zval_possible_root)
  3. --FILE--
  4. <?php
  5. // this makes ob_end_clean raise an error
  6. ob_end_flush();
  7. class ExceptionHandler {
  8. public function __invoke (Exception $e)
  9. {
  10. // this triggers the custom error handler
  11. ob_end_clean();
  12. }
  13. }
  14. // this must be a class, closure does not trigger segfault
  15. set_exception_handler(new ExceptionHandler());
  16. // exception must be thrown from error handler.
  17. set_error_handler(function()
  18. {
  19. $e = new Exception;
  20. $e->_trace = debug_backtrace();
  21. throw $e;
  22. });
  23. // trigger error handler
  24. $a['waa'];
  25. ?>
  26. --EXPECTF--
  27. Notice: ob_end_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %sbug64960.php on line 3
  28. Fatal error: Uncaught Exception in %sbug64960.php:19
  29. Stack trace:
  30. #0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9)
  31. #1 %sbug64960.php(9): ob_end_clean()
  32. #2 [internal function]: ExceptionHandler->__invoke(Object(Exception))
  33. #3 {main}
  34. thrown in %sbug64960.php on line 19