ID: 27125 Updated by: [EMAIL PROTECTED] Reported By: adam at trachtenberg dot com -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: * PHP Version: 5CVS-2004-02-03 (dev) 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: ------------------------------------------------------------------------ [2004-02-03 02:42:06] adam at trachtenberg dot com Description: ------------ When strval() is passed an object with a __toString() method, strval() should return the results of __toString(). This makes strval() consistent with (string), which the PHP manual agree to be the same thing: "You can convert a value to a string using the (string) cast, or the strval() function." See also internals list discussion: http://www.mail- archive.com/[EMAIL PROTECTED]/msg05832.html Reproduce code: --------------- class foo { public function __toString() { return "foo\n"; } } $foo = new foo; print strval($foo); Expected result: ---------------- foo Actual result: -------------- PHP Notice: Object of class foo could not be converted to string in /Users/adam/Documents/php/php5/toString.php on line 10 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27125&edit=1