Re: request globals?

From: Date: Sat, 03 Dec 2005 08:59:28 +0000
Subject: Re: request globals?
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-3313@lists.php.net to get a copy of this message
Greg Beaver wrote:
Hi, I'm trying to figure out the best way to save per-request data. My attempts to use a global HashTable are failing miserably at the first zend_hash_add() with a segfault, and it is clearly because the hashtable is not properly initialized, but I can't figure out where I'm going wrong. Before I plop a bunch of code here, are there some simple steps I should take to make sure that a per-request HashTable is functional? What I am trying to do is to store a per-request list of .phar files and their file manifest.
Putting a HashTable into the module globals struct didn't work? There should be zend_hash_init(&ht, 0, NULL, ZVAL_PTR_DTOR, 0) in RINIT and zend_hash_destroy(&ht) in RSHUTDOWN. If in doubt look at http.c/php_http.h, there is a global HashTable named request.methods.custom which is used in request_method_api. Regards, -- Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz

« previous php.pecl.dev (#3313) next »