Re: Re: Overloaded class registration
| From: | Evan Nemerson | Date: | Wed, 10 Nov 2004 20:49:42 +0000 |
| Subject: | Re: Re: Overloaded class registration | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1602@lists.php.net to get a copy of this message | ||
On Tuesday 09 Nov 2004 14:06, l0t3k wrote:
> evan,
> i've only browsed casually, but it seems that you are using a
> sub-optimal way of implementing properties in an overloaded object.
> __get and __set are more geared for userland code, whereas the
> read_property and write_property callbacks of the zend_object_handlers
> struct is intended for internal objects.
First off, sorry about the delayed response.
If I were doing it from scratch I'd have no problem doing it your way, but I
don't want to break BC. Furthermore, I'd like to be able to override the
behaviour from userland--I'm not 100%, but I don't think your way would allow
for that?
Is there something I'm doing wrong in my code? It seems to me that it should
work, but I'm not nearly so conceded as to automatically assume ZE2 is at
fault ;)
>
> for an example of how this works, check out some old code i wrote at
>
>
> http://cvs.voltex.jp/php-i18n/currency_class.c?rev=1.2&content-type=text/x-
>cvsweb-markup
>
> look for the portion starting with "Object Handler Stuff". it should give
> you a general idea of what needs to be done.
>
> l0t3k
>
> "Evan Nemerson" <evan@coeus-group.com> wrote in message
> news:200411091239.35473.evan@coeus-group.com...
>
> > Hi all,
> >
> > I noticed yesterday that both of my extensions (fann and panda) are
>
> emitting
>
> > error messages in >= 5.0.2 when their methods are
>
> registered--specifically,
>
> > the __get() and __set() methods. In
>
> zend_check_magic_method_implementation(),
>
> > it seems that num_args is always 0, even though they are properly set (or
>
> so
>
> > I thought) prior to registering them.
> >
> > I've tried going through the function registration code a bit, but I'm
> > not very familiar with ZE2 internals, so I thought I'd see if someone
> > else had
>
> an
>
> > idea?
> >
> > The pertinant portion of the code is based on the SOAP extension. The
>
> source
>
> > code for the fann extension is at
>
>
> http://cvs.sourceforge.net/viewcvs.py/*checkout*/fann/fannphp/fann.c?rev=1.
>13
>
> > I would greatly appreciate any help :)
> >
> >
> > --
> > Evan Nemerson
> > evan@coeus-group.com
> > http://coeusgroup.com/en
--
Evan Nemerson
evan@coeus-group.com
http://coeusgroup.com/en