php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #41750 Object casing docs are outdated/wrong
Submitted: 2007-06-20 18:15 UTC Modified: 2007-08-16 15:51 UTC
From: derick@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2007-06-20 18:15 UTC] derick@php.net
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..


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-20 19:05 UTC] bjori@php.net
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 21:50 UTC] derick@php.net
This is different, the other report doesn't mention the casting page at all.
 [2007-08-16 15:51 UTC] vrana@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC