php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #41895 State that no implicit print of objects
Submitted: 2007-07-04 15:32 UTC Modified: 2007-08-17 07:44 UTC
From: phpbugs at localpin dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpbugs at localpin dot com
New email:
PHP Version: OS:

 

 [2007-07-04 15:32 UTC] phpbugs at localpin dot com
Description:
------------
State explicitly in it's own bullet that "print $myObject" breaks in 5.2.



Reproduce code:
---------------
On the Backward Incompatible Changes page (http://be.php.net/manual/en/migration52.incompatible.php), it is not obvious to someone having a problem with "print $myObject" having broken that the solution lies in the section about "__toString()".

I think it would be worth stating as a separate bullet point the following

* "print $myObject" no longer works implicitly.
You will need to define a "__toString()" method to any class which you wish to print directly.  See below the section on __toString() for more details.

This would save people (like me) who are looking for the answer/solution to this problem a lot of time.  The problem is not noticed by people having a "__toString()" method, and so the info about "__toString()" does not initially appear relevant.  The description should relate more directly to the most likely place where such a problem occurs, i.e. why the "print $myObject" has suddenly stopped working.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-16 12:50 UTC] vrana@php.net
"print $foo" is mentioned in the example of __toString().
 [2007-08-17 06:49 UTC] phpbugs at localpin dot com
The problem with the documentation is not that the information does not exist; the problem is that it is not presented in as clear a way as possible.
 [2007-08-17 07:44 UTC] vrana@php.net
"The fallback of returning a string that contains the object identifier was dropped in PHP 5.2.0." is crystal clear.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 01:01:33 2025 UTC