ID: 41750 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: * PHP Version: Irrelevant New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2007-06-20 21:50:24] [EMAIL PROTECTED] This is different, the other report doesn't mention the casting page at all. ------------------------------------------------------------------------ [2007-06-20 19:05:03] [EMAIL PROTECTED] Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See bug#37537 ------------------------------------------------------------------------ [2007-06-20 18:15:52] [EMAIL PROTECTED] Description: ------------ (20:10:03) Вадим: What objects can be cast to string, and what will be the result? (20:10:32) Derick: which PHP version? (20:10:39) Вадим: PHP-5.2.3 (20:10:49) Derick: only objects which implement __toString() afaik (20:11:02) Вадим: Despite the PHP manual saying that the result will allways be "Object", I get a fatal error: "Object of class C could not be converted to string". (20:11:16) Derick: the manual is outdated then (20:11:30) Derick: do you have an url for me where you found this? (20:11:40) Вадим: http://www.php.net/manual/en/language.types.string.php#language.types.string.casting (20:12:12) Вадим: Objects are always converted to the string "Object". If you would like to print out the member variable values of an object for debugging reasons, read the paragraphs below. If you would like to find out the class name of which an object is an instance of, use get_class(). As of PHP 5, __toString() method is used if applicable. (20:12:19) Derick: right, the last line explains it (20:12:23) Derick: but it's not enough (20:12:49) Вадим: it doesn't say that objects that do not implement __toString() cannot be cast. (20:12:52) Derick: right (20:12:59) Derick: which is true for php 5.0 and 5.1 (20:13:24) Derick: i will file a doc bug (20:13:46) Вадим: aha. and why PHP 5.1.x returns "[Object id #1]" and not "Object" ? (20:14:03) Derick: afaik it never returned just "Object" (20:14:07) Derick: perhaps in PHP 4 (20:14:14) Вадим: but this is what the doc says.. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41750&edit=1