He's not going to do anything with them. As a developer you should know that when you've closed the resource that you don't access it again. Similar to accessing a FILE * which has already been fclosed().
That is exactly why you shouldn't NULL it out and let the Zend Engine do its magic :)
Andi


At 10:02 PM 4/18/2005 +0200, Andrey Hristov wrote:
 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 EDT

  Modified files:
    /php-src/ext/ncurses        ncurses_functions.c
  Log:
  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




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



Reply via email to