Hello Cristiano, Monday, August 4, 2003, 4:45:20 AM, you wrote:
CD> 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. CD> Do you think it's an error even if the value returned got cast to string ? The return value of this function must be string anything else is an error dot CD> I don't know how to throw an error/exception from inside the core of Zend2. CD> I have some code to throw an exception/error from extensions... Simply set EG(exception) = class... and experiment with the return value i don't know if it can be NULL or if it must be a valid string in case of an exception gets thrown. >> 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. CD> I modified the code to just call to_string if the object implements the CD> "printable" interface. CD> But I don't know how and where to register the interface in ZE2. Are there CD> any interfaces registered inside ZE2? I cound't find any... an interface is a normal class but one which has only abstract methods and no properties. So you can do the same as if you'd register an abstract class. But when you're done you change the class flag to also contain ZEND_ACC_INTERFACE. CD> If you could point me some code to dig... cvs co -p ext/spl spl -- Best regards, Marcus mailto:[EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php