Re: __toString() with strval() and settype()

From: Date: Fri, 16 Jan 2004 23:14:37 +0000
Subject: Re: __toString() with strval() and settype()
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-7143@lists.php.net to get a copy of this message
On Fri, 16 Jan 2004, Sterling Hughes wrote: > > Adam Maccabee Trachtenberg wrote: > > >Anyone else care to chime in here? If we're really moving to RC1, I > > > > So to summarize that'd be > > echo, print, (string), strval() and settype() > > using __toString(), right? Sounds +1 to me. > > > > settype() is a tricky one - i think it should fail for objects, as it > could cause destruction of the underlying object, as we don't have > magic (in the perl internals meaning of the world). Ah right. settype() modifies the original object instead of returning a cast version of the object. Yea, settype() should probably fail for objects. So, it's: echo, print, (string), strval(), "$obj", and printf("%s", $obj) (plus printf() variants). That's my complete list. AFAIK, everything but strval() works right now. We just need to fix that function. Also, I don't know why exit() would call __toString(). That doesn't make sense to me. -adam -- adam@trachtenberg.com author of o'reilly's php cookbook avoid the holiday rush, buy your copy today!

« previous php.internals (#7143) next »