php-src/Zend/tests/exception_009.phpt
Nikita Popov a31f46421d Allow exceptions in __toString()
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.
2019-06-05 14:25:07 +02:00

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