OnXXXXX handlers not called in ZTS environment
| From: | Uwe Schindler | Date: | Fri, 30 May 2003 23:18:17 +0000 |
| Subject: | OnXXXXX handlers not called in ZTS environment | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-2099@lists.php.net to get a copy of this message | ||
When changing a ini entry with zend_alter_ini_entry during runtime the Callback routines OnUpdateXXXX are never called. This problem only exists in multithreaded environments.
I think that the handler field in the entry is not copied when creating the copy of the ini entries after creating a new thread ressource:
#ifdef ZTS
ZEND_API int zend_copy_ini_directives(TSRMLS_D)
{
zend_ini_entry ini_entry;
EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
return FAILURE;
}
zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry));
zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
return SUCCESS;
}
#endif
I am not very familar with the Zend engine so I do not know how to implement this, but the following command does not ever call the OnUpdate handler:
zend_alter_ini_entry(....., PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME)
Uwe