ID: 34286 Updated by: [EMAIL PROTECTED] Reported By: alek at zvuk dot net -Status: Open +Status: Assigned Bug Type: Feature/Change Request Operating System: * PHP Version: 5.* Assigned To: helly
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