Hi,

On Wed, December 31, 2014 23:21, Anatol Belski wrote:
> Hi,
>
>
> related to bug #43525, I see that zend_fetch_resource() still expects a
> default id as int as parameter. After some investigation i think that the
>  "int default_id" argument can be surely dropped from the signature. The
> only extension in the core passing it is ext/interbase, all the others pass
> -1. Any other zend_list_* signature expects no integer but a
> zend_resource*.
>
> What I would do instead - transfer the control over the defauld_id to the
>  corresponding extension. Maybe also making a helper function in
> zend_list.c, if it proves itself as needed. But in any case, to be
> consistent, the consistency should be that the api only works with
> zend_resource *.
>
Here's a small patch i've invented to illustrate the idea
https://gist.github.com/weltling/9367db5e242ef7e60042 . The most relevant
change is in zend_list.[h|c].

I've also exemplarly ported ext/mysql and ext/pgsql. The macros
ZEND_FETCH_RESOURCE*() would not change the meaning, but new macros
ZEND_FETCH_RESOURCE_FROM_*() are introduced. Also the
zend_fetch_resource() function is removed. From the code base, the new
function zend_fetch_resource_from_zval() were suitable, which would spare
several branchings.

Thanks

Anatol











-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to