Re: cvs: php-src /ext/ncurses ncurses_functions.c
| From: | Andrey Hristov | Date: | Mon, 18 Apr 2005 20:02:55 +0000 |
| Subject: | Re: cvs: php-src /ext/ncurses ncurses_functions.c | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16023@lists.php.net to get a copy of this message | ||
Ok, my fault. I did a simple extentions to check and the result is
that next time someone tries to use the resource it will fail with sth like :
PHP Warning: tst_use(): 4 is not a valid Testing resource in Command line code on line 1
But IMO, the message is not that clear.
Still, if the user has copies of the resource what he is going to do with them after
the underlying one is freed?
Andrey
Andi Gutmans wrote:
I think you are wrong. It should give a nice warning message. It's pointless in doing this, because you could have other copies of the resource in other PHP variables. Please nuke that... Thanks, Andi At 11:38 PM 4/16/2005 +0200, Andrey Hristov wrote:Hi Andi, last time I checked with 5.1 I was getting sth like resource(%d) of Unknown type .... Which leads me to think that the user may pass the resource to a function and it will greacefully go through zend_parse_parameters() and will fail probably during FETCH_RESOURCE with getting a FALSE back but without any warning. But it is possible that I am wrong. Andrey Andi Gutmans wrote:Andrey, You should remove ZVAL_NULL(). We don't NULL resource zval if they are deleted. PHP handles that gracefully if mistakenly accessed... Andi At 10:23 PM 4/10/2005 +0000, Andrey Hristov wrote:andrey Sun Apr 10 17:23:28 2005 EDTModified files:/php-src/ext/ncurses ncurses_functions.cLog: fix proto. return true instead of null http://cvs.php.net/diff.php/php-src/ext/ncurses/ncurses_functions.c?r1=1.46&r2=1.47&ty=u Index: php-src/ext/ncurses/ncurses_functions.c diff -u php-src/ext/ncurses/ncurses_functions.c:1.46 php-src/ext/ncurses/ncurses_functions.c:1.47--- php-src/ext/ncurses/ncurses_functions.c:1.46 Wed Jan 19 21:02:09 2005 +++ php-src/ext/ncurses/ncurses_functions.c Sun Apr 10 17:23:27 2005@@ -84,7 +84,7 @@ /* }}} */ #endif -/* {{{ proto int ncurses_delwin(resource window) +/* {{{ proto bool ncurses_delwin(resource window)Deletes a ncurses window */PHP_FUNCTION(ncurses_delwin) { @@ -98,6 +98,8 @@FETCH_WINRES(w, &handle);zend_list_delete(Z_LVAL_P(handle)); + ZVAL_NULL(handle); + RETURN_TRUE;} /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php