Re: zend_API.c - missing zend_update_property_resource
| From: | Nicolai Scheer | Date: | Thu, 05 Jun 2014 19:21:52 +0000 |
| Subject: | Re: zend_API.c - missing zend_update_property_resource | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74762@lists.php.net to get a copy of this message | ||
Hi!
On 4 June 2014 23:34, Johannes Schlüter <johannes@schlueters.de> wrote:
> On Wed, 2014-06-04 at 21:52 +0200, Nicolai Scheer wrote:
> > Hi,
> >
> > is it by itention, that there is no zend_update_property_resource in
> > zend_API.c (as of 5.5.12)?
>
> The reason most likely is that nobody needed it, yet. I also don't see
> the need right now:
>
> * resources are handled as zvals, thos can be passed by
> zend_update_property(). The other are just wrappers creating the
> zval first.
>
Of course it is no big deal to use zend_update_property and create the zval
myself :)
> * Usage of resources is discouraged, instead of a resource use an
> object (extend zend_object to store pointers etc.)
>
Didn't know that usage of resources was discouraged... Nearly all my
knowledge comes from Sara's great book (btw. if you read this Sara, I'd
love to see and buy a refreshed version!) and my own field tests.
When you say "use an object", do you refer to the way described in [1]?
From what I've read so far, this way sounds more complex than just
registering a resource.
Could you elaborate a bit on the rationale behind this recommendation?
> > What is the usual and official way to add such a function and what can I
> do
> > to make it happen?
>
> The typical case that a developer who has a need creates a patch and
> depending on impact and the developer's brevity pushes it, sends it to
> the ist or creates an RFC. Developers without karma can only do the
> later (or now somebody with karma)
>
> > If such a thing was added, would this be considered an api change - i.e..
> > the zend api number would be adjusted?
>
> Edge case. By strict rules yes, but there are enough previous examples
> where we added APIs. Depends on brevity and need as above ;-)
>
> johannes
>
>
Thanks for the detailed info!
Greetings
Nico
[1]
http://www.phpinternalsbook.com/classes_objects/custom_object_storage.html