xref: /PHP-5.5/Zend/tests/bug46241.phpt (revision 3919b16f)
1--TEST--
2Bug #46241 (error handler stacks)
3--FILE--
4<?php
5
6class ErrorHandling
7{
8
9    public function errorHandler1( $errno, $errstr )
10    {
11        echo "Caught on first level: '$errstr'\n";
12        return true;
13    }
14
15    public function errorHandler2( $errno, $errstr )
16    {
17        echo "Caught on second level: '$errstr'\n";
18        return true;
19    }
20}
21
22$err = new ErrorHandling();
23
24set_error_handler( array( $err, 'errorHandler1' ) );
25set_error_handler( array( $err, 'errorHandler2' ) );
26
27trigger_error( 'Foo', E_USER_WARNING );
28
29function errorHandler1( $errno, $errstr )
30{
31    echo "Caught on first level: '$errstr'\n";
32    return true;
33}
34
35function errorHandler2( $errno, $errstr )
36{
37    echo "Caught on second level: '$errstr'\n";
38    return true;
39}
40
41set_error_handler( 'errorHandler1' );
42set_error_handler( 'errorHandler2' );
43
44trigger_error( 'Foo', E_USER_WARNING );
45?>
46==END==
47--EXPECT--
48Caught on second level: 'Foo'
49Caught on second level: 'Foo'
50==END==
51