[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-dev
Subject:    [PECL-DEV] php_stack_globals_dtor woes minimal example
From:       Holger Blasum <holgerlists-php () blasum ! net>
Date:       2007-03-18 11:13:13
Message-ID: 20070318111313.GA16589 () tosh
[Download RAW message or body]


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

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic