mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
Add directories for tests relating to - `break` statements - functions with by-ref returns - `class_exists()` - dynamic properties - error handlers - error suppression with `@` - `get_object_vars()` - `highlight_string()` and `highlight_file()` - interfaces - `is_callable()` - iterators - shutdown functions - streams As well as organizing a couple of tests into existing sub directories along the way Work towards GH-15631
51 lines
968 B
PHP
51 lines
968 B
PHP
--TEST--
|
|
Bug #46241 (error handler stacks)
|
|
--FILE--
|
|
<?php
|
|
|
|
class ErrorHandling
|
|
{
|
|
|
|
public function errorHandler1( $errno, $errstr )
|
|
{
|
|
echo "Caught on first level: '$errstr'\n";
|
|
return true;
|
|
}
|
|
|
|
public function errorHandler2( $errno, $errstr )
|
|
{
|
|
echo "Caught on second level: '$errstr'\n";
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$err = new ErrorHandling();
|
|
|
|
set_error_handler( array( $err, 'errorHandler1' ) );
|
|
set_error_handler( array( $err, 'errorHandler2' ) );
|
|
|
|
trigger_error( 'Foo', E_USER_WARNING );
|
|
|
|
function errorHandler1( $errno, $errstr )
|
|
{
|
|
echo "Caught on first level: '$errstr'\n";
|
|
return true;
|
|
}
|
|
|
|
function errorHandler2( $errno, $errstr )
|
|
{
|
|
echo "Caught on second level: '$errstr'\n";
|
|
return true;
|
|
}
|
|
|
|
set_error_handler( 'errorHandler1' );
|
|
set_error_handler( 'errorHandler2' );
|
|
|
|
trigger_error( 'Foo', E_USER_WARNING );
|
|
?>
|
|
==END==
|
|
--EXPECT--
|
|
Caught on second level: 'Foo'
|
|
Caught on second level: 'Foo'
|
|
==END==
|