Re: Re: hook cast_object handler in userspace
| From: | Cristiano Duarte | Date: | Mon, 04 Aug 2003 02:45:20 +0000 |
| Subject: | Re: Re: hook cast_object handler in userspace | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3715@lists.php.net to get a copy of this message | ||
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