problem with ressources on reload

From: Date: Wed, 25 Jul 2001 11:04:34 +0000
Subject: problem with ressources on reload
Groups: php.dev 
Request: Send a blank email to php-dev+get-60942@lists.php.net to get a copy of this message
Hi, I'm writing an extension PHP 4.06, VC++6 and doing OO syntax overloading and ZTS I'm using a global struct that is defined as ZTS global typedef struct { HashTable *array_dl_handle; HashTable *array_compiler; } php_delphi_globals; I'm using a ressource. This ressource is created as : ... typedef struct { void * handle; CREATEOBJECT GetObject; GETCOMPILER GetCompiler; DESTROYOBJECT DestroyObject; char *module_name; } php_delphi_user; ... le_pdu = zend_register_list_destructors_ex(NULL, NULL, "delphi_pdu", module_number); ... This ressource once created is added to the global Hashtable array_dl_handle: pdu = emalloc(sizeof(php_delphi_user)); MAKE_STD_ZVAL(pdu_handle); ZVAL_LONG(pdu_handle, zend_list_insert(pdu, le_pdu)); zend_hash_add(DG(array_dl_handle) ,module_name,strlen(module_name),&pdu_handle,sizeof(zval *),NULL); On first request everything goes fine. I can access my ressource. On second request with the same script, when I do if (zend_hash_find(DG(array_dl_handle), module_name,strlen(module_name), (void **)&value) == SUCCESS) { pdu = zend_list_find((*value)->value.lval, &type) ; } , pdu is false. Does ressources survive between requests ? Is it mandatory to use the ressource feature to create structures ? What am I doing wrong ? Thank's Gilles

« previous php.dev (#60942) next »