Re: __toString()

From: Date: Mon, 15 Dec 2003 17:32:35 +0000
Subject: Re: __toString()
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-6477@lists.php.net to get a copy of this message
Monday, December 15, 2003, 1:28:41 PM, you wrote: > Guys, > We have had this discussion before. There are two extremes to this issue. > The first is to always require the explicit __toString() call and the > second is to never require it and have all places in PHP whether it's > str_replace(), (string)$obj, $arr[$obj] to automatically convert to string. > The latter is problematic because it propagates to far too many places and > causes too much magic in my opinion. > I think the right trade off is to automatically convert it with "print" and > with concatenation. All the rest will require explicit calling. > It might not be your dream but it's a realistic approach. helly Mon Dec 15 11:59:21 2003 EDT Modified files: /php-src/tests/classes tostring.phpt /ZendEngine2 zend.c zend_object_handlers.c zend_object_handlers.h Log: Reenable __tostring() magic for print,echo,concatenation,function naming... but not for other internal things. (...) Guys, please try php-cvs version and report any problems (or dislike) as soon as possible. regards marcus

« previous php.internals (#6477) next »