Re: Bug in oracle.c in php4
| From: | Kirill Maximov | Date: | Tue, 10 Oct 2000 17:23:34 +0000 |
| Subject: | Re: Bug in oracle.c in php4 | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-34608@lists.php.net to get a copy of this message | ||
Derick Rethans wrote:
>
> Hi,
>
> ok, it verfies it, but the ora_close functino should return an int, and NULL is no int.
> Any suggestion left?
>
> I thought of the following code:
>
> -------------
> /* {{{ proto int ora_close(int cursor)
> Close an Oracle cursor */
> PHP_FUNCTION(ora_close)
> { /* conn_index */
> pval **arg;
> oraCursor *cursor;
>
> if (zend_get_parameters_ex(1, &arg) == FAILURE) {
> WRONG_PARAM_COUNT;
> }
> ZEND_FETCH_RESOURCE(cursor, , );
On an error, it'll return NULL here. I'm afraid, it should be like this:
cursor = (oraCursor *) zend_fetch_resource(arg, -1, "Oracle-Cursor", NULL, 1,
le_cursor);
if (!cursor)
RETURN_FALSE;
>
> if (zend_list_delete((*arg)->value.lval) == FAILURE)
> RETURN_FALSE
>
> RETURN_TRUE;
> }
> /* }}} */
> --------
>
> Derick
>
> chrisv@b0rked.dhs.org wrote:
>
> > On Tue, 10 Oct 2000, Derick Rethans wrote:
> >
> > > Hi,
> > >
> > > it seems that you cannot check if ZEND_FETCH_RESOURCE2 succeeds or not.
> >
> > It verifies it for you--
> >
> > Zend/zend_list.h:97 --
> > #define ZEND_VERIFY_RESOURCE(rsrc) \
> > if (!rsrc) { \
> > RETURN_NULL(); \
> > }
> >
> > Zend/zend_list.h:102 --
> > #define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name,
> > resource_type1,resource_type2) \
> > rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name,
> > NULL, 2, resource_type1, resource_type2); \
> > ZEND_VERIFY_RESOURCE(rsrc);
> >
> > So if the resource is not found, null is returned.
> >
> > Chris
>
> --
> Derick Rethans
> JDI Media Solutions
>
> H.v.Tussenbroekstraat 1
> 6952 BL Dieren
> The Netherlands
>
> e-mail: d.rethans@jdimedia.nl
> http://www.jdimedia.nl/
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
Attachment: [text/x-vcard] Card for Kirill Maximov kir.vcf
Attachment: [text/x-vcard] Card for Kirill Maximov kir.vcf