mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
a31f46421d
RFC: https://wiki.php.net/rfc/tostring_exceptions And convert some object to string conversion related recoverable fatal errors into Error exceptions. Improve exception safety of internal code performing string conversions.
33 lines
674 B
PHP
33 lines
674 B
PHP
--TEST--
|
|
Testing exception properties
|
|
--FILE--
|
|
<?php
|
|
|
|
class my_file
|
|
{
|
|
public function __toString()
|
|
{
|
|
return "somebuildfilename" ;
|
|
}
|
|
}
|
|
|
|
class my_exception extends exception
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->message = new stdclass ;
|
|
$this->file = new my_file ;
|
|
$this->line = "12" ;
|
|
}
|
|
}
|
|
|
|
throw new my_exception;
|
|
|
|
?>
|
|
--EXPECT--
|
|
Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in [no active file]:0
|
|
Stack trace:
|
|
#0 [internal function]: Exception->__toString()
|
|
#1 {main}
|
|
thrown in [no active file] on line 0
|