logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

php_stack_globals_dtor woes minimal example: msg#00036

Subject: php_stack_globals_dtor woes minimal example
Hello peclers again, 

here would be a minimal self-contained example of what I had posted 
on Wednesday. This crashes (as below) when calling
ZEND_INIT_MODULE_GLOBALS(stack,php_stack_globals_ctor,php_stack_globals_dtor);
in PHP_MINIT_FUNCTION(stack) but runs fine when I would be using
ZEND_INIT_MODULE_GLOBALS(stack,php_stack_globals_ctor,NULL) instead.

#include "php.h"
#include "TSRM.h"

extern zend_module_entry stack_module_entry;
#define stack_module_ptr &stack_module_entry

PHP_MINIT_FUNCTION(stack);
PHP_MSHUTDOWN_FUNCTION(stack);
PHP_MINFO_FUNCTION(stack);

#define phpext_stack_ptr stack_module_ptr

int stack_globals_id;

#define stack_globals(v) TSRMG(stack_globals_id, zend_stack_globals *, v)

ZEND_BEGIN_MODULE_GLOBALS(stack)
ZEND_END_MODULE_GLOBALS(stack)

ZEND_DECLARE_MODULE_GLOBALS(stack);

static function_entry stack_functions[] = {
        {NULL,NULL,NULL}
};

zend_module_entry stack_module_entry = {
STANDARD_MODULE_HEADER,
"stack",
stack_functions,
PHP_MINIT(stack),  /*module startup*/
NULL, /*module shutdown*/
NULL, /*request startup*/
NULL, /*request shutdown*/
NULL, /*phpinfo*/
NULL /*php version*/
};

ZEND_GET_MODULE(stack)

static void php_stack_globals_ctor (zend_stack_globals *stack_globals 
TSRMLS_DC) {

}

static void php_stack_globals_dtor (zend_stack_globals *stack_globals 
TSRMLS_DC) {
}

PHP_MINIT_FUNCTION(stack) {
        
ZEND_INIT_MODULE_GLOBALS(stack,php_stack_globals_ctor,php_stack_globals_dtor);
}

---->

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211328128 (LWP 16584)]
0xb7fab5ab in ?? ()
(gdb) bt
#0  0xb7fab5ab in ?? ()
#1  0x08195792 in tsrm_shutdown () at
/usr/local/php-5.2.0/TSRM/TSRM.c:180
#2  0x08282bf1 in main (argc=2, argv=0xbfeed254)
    at /usr/local/php-5.2.0/sapi/cli/php_cli.c:1277

Sorry for the whining :-) (also will happily accept pointers to RTFM)

-- 
Holger Blasum +49-174-7313590 (cell) GnuPG 1024D/ACDFC3B769DC1ED66B47

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>