#41895 [Opn->Bgs]: State that no implicit print of objects

From: Date: Thu, 16 Aug 2007 12:50:27 +0000
Subject: #41895 [Opn->Bgs]: State that no implicit print of objects
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969377411@lists.php.net to get a copy of this message
ID: 41895 Updated by: vrana@php.net Reported By: phpbugs at localpin dot com -Status: Open +Status: Bogus Bug Type: Documentation problem PHP Version: Irrelevant New Comment: "print $foo" is mentioned in the example of __toString(). Previous Comments: ------------------------------------------------------------------------ [2007-07-04 15:32:05] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41895&edit=1

« previous php.doc (#969377411) next »