File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug45805.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Bug #45805 (Crash on throwing exception from error handler)
    3: --SKIPIF--
    4: <?php extension_loaded('reflection') or die('skip'); ?>
    5: --FILE--
    6: <?php
    7: class PHPUnit_Util_ErrorHandler
    8: {
    9:     public static function handleError($errno, $errstr, $errfile, $errline)
   10:     {
   11:         throw new RuntimeException;
   12:     }
   13: }
   14: 
   15: class A {
   16:     public function getX() {
   17:         return NULL;
   18:     }
   19: }
   20: 
   21: class B {
   22:     public function foo() {
   23:         $obj    = new A;
   24:         $source = &$obj->getX();
   25:     }
   26: 
   27:     public function bar() {
   28:         $m = new ReflectionMethod('B', 'foo');
   29:         $m->invoke($this);
   30:     }
   31: }
   32: 
   33: set_error_handler(
   34:   array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT
   35: );
   36:             
   37: $o = new B;
   38: $o->bar();
   39: ?>
   40: --EXPECTF--
   41: Fatal error: Uncaught exception 'RuntimeException' in %sbug45805.php:%d
   42: Stack trace:
   43: #0 %sbug45805.php(%d): PHPUnit_Util_ErrorHandler::handleError(2048, 'Only variables ...', '%s', %d, Array)
   44: #1 [internal function]: B->foo()
   45: #2 %sbug45805.php(%d): ReflectionMethod->invoke(Object(B))
   46: #3 %sbug45805.php(%d): B->bar()
   47: #4 {main}
   48:   thrown in %sbug45805.php on line %d

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