Resource management (continued)
| From: | Yannick Warnier | Date: | Tue, 02 Nov 2004 13:32:42 +0000 |
| Subject: | Resource management (continued) | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-1575@lists.php.net to get a copy of this message | ||
Hi,
I've added some stuff to my extension and compiled successfully. I have
now three functions: ssh_test, ssh_options_new and ssh_session.
ssh_test(string) simply gets a string and returns it, unchanged. The
function compiles and works nicely.
Then for the other two functions (the ones were I'm trying to use
resources) I was having this error in Apache when trying to run them:
Warning: Unknown list entry type in request shutdown (0) in Unknown on
line 0
So I implemented a dtor function like this:
static void ssh_options_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
SSH_OPTIONS *options = (SSH_OPTIONS *) rsrc;
ssh_options_destroy(rsrc);
}
PHP_MINIT_FUNCTION(ssh)
{
le_ssh_options = zend_register_list_destructors_ex(ssh_options_dtor,
NULL, "ssh options", module_number);
}
ZEND_FUNCTION(ssh_options_destroy)
{
zval *o;
SSH_OPTIONS *options;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &o) ==
FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(options, SSH_OPTIONS *, &o, -1, "ssh",
le_ssh_options);
zend_list_delete(Z_LVAL_P(o));
}
But this didn't help.
I think I got something wrong in the pointers succession (SSH_OPTIONS
*options becomes zval *o and then there is this *rsrc which I don't know
how it's handeld and if I don't need to apply it the SSH_OPTIONS *
type...)
Anyway, can someone tell me what my error message could be about? I
don't have a clue.
Thanks,
Yannick