我正在使用PHP 5.4.0。
参见ZEND_。 MINIT -FUNCTION
#ifdef ZTS
ts_allocate_id( &sample_globals_id,
sizeof(zend_sample_globals),
(ts_allocate_ctor) php_sample_init_globals,
(ts_allocate_dtor) php_sample_destroy_globals);
#else
php_sample_init_globals(& sample_globals TSRMLS_CC);
#endif
This code crashes, when module finishes its MSHUTDOWN. GDB points to TSRM.c , this line (the call to dtor):
if (p->storage[j]) {
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
resource_types_table[j].dtor(p->storage[j], &p->storage);
}
free(p->storage[j]);
}
即便是陌生人,当我以全国人民力量取代代行者职能时,它就发挥了作用。 与此类似:
ts_allocate_id( &sample_globals_id,
sizeof(zend_sample_globals),
(ts_allocate_ctor) php_sample_init_globals,
NULL ); //Works, but destructor is not called
Perhaps anybody has an idea why this could happen? Thank you