ID: 26266
Comment by: php at bouchery dot com
Reported By: adam at trachtenberg dot com
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2003-11-15 (dev)
New Comment:
I've the same error but without concatenation.
<?php
class MyException extends Exception {
function __toString()
{
echo '(MyException)';
}
}
try {
throw new MyException('test');
} catch(Exception $e) {
echo $e;
}
?>
When "echo $e" is call => crash
If I replace "echo $e" by "echo $e->__toString()", it work fine.
Previous Comments:
------------------------------------------------------------------------
[2003-11-15 15:08:55] adam at trachtenberg dot com
Description:
------------
Concatenating objects that define a __toString() method
using the "." operator causes a bus error.
Reproduce code:
---------------
class foo {
function __toString() {
return "foo";
}
}
$foo = new foo;
echo $foo . "\n";
Expected result:
----------------
foo
Actual result:
--------------
Bus error.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26266&edit=1