ID: 34286 Updated by: [EMAIL PROTECTED] Reported By: alek at zvuk dot net -Status: Assigned +Status: Closed Bug Type: Feature/Change Request Operating System: * PHP Version: 5.* Assigned To: helly New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-08-28 10:59:57] alek at zvuk dot net Description: ------------ There are three different ways objects are converted to strings and they are inconsistent (depends on what function you are using). I think all object-to-string conversions should be done via __toString() if it is defined, even if the object is in quotes. Reproduce code: --------------- <?php class Message { function __toString() { return "Hello, World!\n"; } } $w = new Message; echo("$w"); echo("Message: " . $w); echo(substr($w,0)); echo($w); Expected result: ---------------- Hello, World! Message: Hello, World! Hello, World! Hello, World! Actual result: -------------- Object id #1 Message: Object id #1 Object Hello, World! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34286&edit=1