cvs: ZendEngine2(PHP_5_0) / zend_ini.c

From: Date: Fri, 30 Jul 2004 15:05:02 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_ini.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2826@lists.php.net to get a copy of this message
wez Fri Jul 30 11:05:02 2004 EDT Modified files: (Branch: PHP_5_0) /ZendEngine2 zend_ini.c Log: MFH: zts fix for ini entries and dl() http://cvs.php.net/diff.php/ZendEngine2/zend_ini.c?r1=1.33&r2=1.33.2.1&ty=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.33 ZendEngine2/zend_ini.c:1.33.2.1 --- ZendEngine2/zend_ini.c:1.33 Mon Apr 12 08:22:26 2004 +++ ZendEngine2/zend_ini.c Fri Jul 30 11:05:02 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.33 2004/04/12 12:22:26 andi Exp $ */ +/* $Id: zend_ini.c,v 1.33.2.1 2004/07/30 15:05:02 wez Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -147,10 +147,25 @@ zend_ini_entry *p = ini_entry; zend_ini_entry *hashed_ini_entry; zval default_value; + HashTable *directives = registered_zend_ini_directives; + +#ifdef ZTS + /* if we are called during the request, eg: from dl(), + * then we should not touch the global directives table, + * and should update the per-(request|thread) version instead. + * This solves two problems: one is that ini entries for dl()'d + * extensions will now work, and the second is that updating the + * global hash here from dl() is not mutex protected and can + * lead to death. + */ + if (directives != EG(ini_directives)) { + directives = EG(ini_directives); + } +#endif while (p->name) { p->module_number = module_number; - if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { + if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) { zend_unregister_ini_entries(module_number TSRMLS_CC); return FAILURE; }

« previous php.zend-engine.cvs (#2826) next »