Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3715 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51271 invoked by uid 1007); 4 Aug 2003 02:46:28 -0000 Message-ID: <20030804024628.51269.qmail@pb1.pair.com> To: internals@lists.php.net References: <20030802224959.58552.qmail@pb1.pair.com> <20030802230007.65232.qmail@pb1.pair.com> <20030803033323.97051.qmail@pb1.pair.com> <13610291366.20030803105909@post.rwth-aachen.de> <20030803144736.43225.qmail@pb1.pair.com> <20030803195505.18983.qmail@pb1.pair.com> <1639357698.20030803225953@post.rwth-aachen.de> <20030803221049.98562.qmail@pb1.pair.com> <761875207.20030804001846@post.rwth-aachen.de> <20030803223448.11328.qmail@pb1.pair.com> <805561028.20030804023822@post.rwth-aachen.de> Date: Sun, 3 Aug 2003 23:45:20 -0300 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 200.196.104.198 Subject: Re: [PHP-DEV] Re: hook cast_object handler in userspace From: cunha17@uol.com.br ("Cristiano Duarte") Hello Marcus, > CD> switch/case removed and patch attached. Is it ok? > CD> Should the method be named "to_string()", "tostring()" or "__tostring()" ? > CD> Do you commit it to CVS ? > > No. Last Problem i see is that even when to_string() is available the default > behavior can get called that seems wrong. If that function doesn't return a > string it's an error and it shouldn't fall back to default in that case. Do you think it's an error even if the value returned got cast to string ? I don't know how to throw an error/exception from inside the core of Zend2. I have some code to throw an exception/error from extensions... > However with that last change the thing would be ok from my point of view. > Perhaps you could also add an interface for that function as sterling once > suggested. But still you need to discuss this with the rest of the ppl here. > Because eventually we might want to do it with overloadable object handlers. I modified the code to just call to_string if the object implements the "printable" interface. But I don't know how and where to register the interface in ZE2. Are there any interfaces registered inside ZE2? I cound't find any... If you could point me some code to dig... Cristiano Duarte