mirror of
https://github.com/php/php-src.git
synced 2026-04-29 03:03:26 +02: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.
35 lines
355 B
PHP
35 lines
355 B
PHP
--TEST--
|
|
ZE2 __toString() in __destruct/exception
|
|
--FILE--
|
|
<?php
|
|
|
|
class Test
|
|
{
|
|
function __toString()
|
|
{
|
|
throw new Exception("Damn!");
|
|
return "Hello\n";
|
|
}
|
|
|
|
function __destruct()
|
|
{
|
|
echo $this;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
$o = new Test;
|
|
$o = NULL;
|
|
}
|
|
catch(Exception $e)
|
|
{
|
|
var_dump($e->getMessage());
|
|
}
|
|
|
|
?>
|
|
====DONE====
|
|
--EXPECT--
|
|
string(5) "Damn!"
|
|
====DONE====
|