#29295 [Opn->Bgs]: die() does not call $obj->__toString()
| From: | helly@php.net | Date: | Wed, 21 Jul 2004 18:13:09 +0000 |
| Subject: | #29295 [Opn->Bgs]: die() does not call $obj->__toString() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63276@lists.php.net to get a copy of this message | ||
ID: 29295
Updated by: helly@php.net
Reported By: scm2tj at cs dot cf dot ac dot uk
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
PHP Version: 5.0.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In 5.0.x __toString() will only be called automatically for print/echo.
Maybe we will change that for 5.1.x if we find out how.
Previous Comments:
------------------------------------------------------------------------
[2004-07-21 12:58:23] scm2tj at cs dot cf dot ac dot uk
Description:
------------
Using the die() function and passing a object as a parameter, you'd
expect the __toString() function to be called, but it isn't. I
understand there are problems with concatenation, but in this instance,
just the object is being passed.
Reproduce code:
---------------
<?php
class Foobar {
public function __toString() {
return "Foo";
}
}
$bar = new Foobar;
die($bar);
?>
Expected result:
----------------
Foo
Actual result:
--------------
Object id #1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29295&edit=1