Bug #26166 (__toString() crash when no values returned)
--FILE--
<?php
+
class Foo
{
function __toString()
$o = new Bar;
echo $o;
+echo "===NONE===\n";
+
+function my_error_handler($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
+}
+
+set_error_handler('my_error_handler');
+
+class None
+{
+ function __toString() {
+ }
+}
+
+$o = new None;
+echo $o;
+
echo "===THROW===\n";
class Error
echo "Got the exception\n";
}
-echo "===NONE===\n";
-
-class None
-{
- function __toString() {
- }
-}
-
-$o = new None;
-echo $o;
-
?>
===DONE===
--EXPECTF--
Hello World!
-===THROW===
-Got the exception
===NONE===
+string(52) "Method None::__toString() must return a string value"
+===THROW===
-Catchable fatal error: Method None::__toString() must return a string value in %sbug26166.php on line %d
+Fatal error: Object of class Error could not be converted to string in %sbug26166.php on line %d