Re: toString() and Object #ID
| From: | Evert | Rooftop | Date: | Fri, 29 Jun 2007 14:56:10 +0000 |
| Subject: | Re: toString() and Object #ID | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-30367@lists.php.net to get a copy of this message | ||
Hi Lars,
In the meanwhile .. check out spl_object_hash
Evert
Lars Schultz wrote:
Hi there I just tried to switch from 5.1 to 5.2.3 and got thrown off right away by: "Object of class MyObject could not be converted to string" I googled a bit and also read any Messages in the internals list but couldn't find a decisive answer as to wether this will stay this way or not. In the "PHP 5 Bug Summary Report" I found Bug # 40799 "change string conversion behaviour for objects not implementing __toString()" which is still open. I don't want to complain or anything but I'd like to know wether it's feasible to wait for a change in this current, modified, behaviour or if it's going to stay this way. I used the previous behaviour mostly for debugging purposes where I wanted to get a visual (string) handle for any given object, which helps ALOT when trying to figure out wether one has a copy or the original and wether to references point to the same object....(obj1 === obj2 is not always helpful). Is there any other way than casting an object to a string to get an objects #ID? Thanks for your time. Lars