I'm talking about (string)$obj calling the cast handler in overloaded objects; COM does not have a __toString() method, and we shouldn't be cluttering up the "method-space" for overloaded objects - what if the underlying object has a __toString() method?
I'm not particularly worried about __toString() for regular user-defined objects, but for overloaded objects, we need that (string) cast stuff to work so that people can serialize() things like variant dates, integer values etc. // Perfect $v = new variant("12/01/03", VT_DATE); serialize((string)$v); // this cannot work- VT_DATE has no methods serialize($v->__toString()); // PHP string cast gets in the way of // the real __toString() call. $v = new COM("Object.With.toString.Method"); serialize($v->__toString()); --Wez. > I don't think casting an object to a string should work. > I don't see why this is any better than the more verbose $obj->__toString(). > > Can you please explain in what situation you need __toString() to be called > for SimpleXML and COM automatically and we can try and think of a solution > together. A possible solution is to remove the comment I put and to remove > the __toString > () call in the std objects cast handler. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php