File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug64960.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:17 2013 UTC (11 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

    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: 
    8: class ExceptionHandler {
    9: 	public function __invoke (Exception $e)
   10: 	{
   11: 		// this triggers the custom error handler
   12: 		ob_end_clean();
   13: 	}
   14: }
   15: 
   16: // this must be a class, closure does not trigger segfault
   17: set_exception_handler(new ExceptionHandler());
   18: 
   19: // exception must be throwed from error handler.
   20: set_error_handler(function()
   21: {
   22: 	$e = new Exception;
   23: 	$e->_trace = debug_backtrace();
   24: 	
   25: 	throw $e;
   26: });
   27: 
   28: // trigger error handler
   29: $a['waa'];
   30: ?>
   31: --EXPECTF--
   32: Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %sbug64960.php on line 3
   33: 
   34: Fatal error: Uncaught exception 'Exception' in %sbug64960.php:19
   35: Stack trace:
   36: #0 [internal function]: {closure}(8, 'ob_end_clean():...', '%s', 9, Array)
   37: #1 %sbug64960.php(9): ob_end_clean()
   38: #2 [internal function]: ExceptionHandler->__invoke(Object(Exception))
   39: #3 {main}
   40:   thrown in %sbug64960.php on line 19

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>