From: [EMAIL PROTECTED] Operating system: * PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Object casing docs are outdated/wrong
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 bug report at http://bugs.php.net/?id=41750&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41750&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41750&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41750&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41750&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41750&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41750&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41750&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41750&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41750&r=support Expected behavior: http://bugs.php.net/fix.php?id=41750&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41750&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41750&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41750&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41750&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41750&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41750&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41750&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41750&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41750&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41750&r=mysqlcfg