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

22 lines
388 B
PHP

--TEST--
Closure 015: converting to string/unicode
--FILE--
<?php
$x = function() { return 1; };
try {
print (string) $x;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
print $x;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Object of class Closure could not be converted to string
Object of class Closure could not be converted to string