#30581 [Opn->Bgs]: Converting of object to string does not work properly.
| From: | derick@php.net | Date: | Wed, 27 Oct 2004 12:51:34 +0000 |
| Subject: | #30581 [Opn->Bgs]: Converting of object to string does not work properly. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68387@lists.php.net to get a copy of this message | ||
ID: 30581
Updated by: derick@php.net
Reported By: kievman at ukrpost dot net
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Win2k server
PHP Version: 5.0.1
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
.
Previous Comments:
------------------------------------------------------------------------
[2004-10-27 14:13:46] kievman at ukrpost dot net
Description:
------------
Converting of object to string does not work properly. The code below
explains all.
Reproduce code:
---------------
<?php
class Foo {
function __toString() {
return "What ever";
}
}
$obj = new Foo;
$str = (string) $obj; // call __toString()
echo $obj; // call __toString(), prints "What ever", it's good
print $str; // prints "Object id #1" it's not good
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30581&edit=1