Re: Bug in oracle.c in php4

From: Date: Tue, 10 Oct 2000 17:12:49 +0000
Subject: Re: Bug in oracle.c in php4
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-34607@lists.php.net to get a copy of this message
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, oraCursor *, arg, -1, "Oracle-Cursor", le_cursor); 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/

« previous php.dev (#34607) next »