php-src/Zend/tests/bug60909_2.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

24 lines
485 B
PHP

--TEST--
Bug #60909 (custom error handler throwing Exception + fatal error = no shutdown function).
--FILE--
<?php
register_shutdown_function(function(){echo("\n\n!!!shutdown!!!\n\n");});
class Bad {
public function __toString() {
throw new Exception('I CAN DO THIS');
}
}
$bad = new Bad();
echo "$bad";
--EXPECTF--
Fatal error: Uncaught Exception: I CAN DO THIS in %s:%d
Stack trace:
#0 %s(%d): Bad->__toString()
#1 {main}
thrown in %s on line %d
!!!shutdown!!!