]> granicus.if.org Git - php/commitdiff
MFB: - Fixed bug #34307. We were not calling on_modify handler to set the default
authorfoobar <sniper@php.net>
Fri, 2 Sep 2005 21:08:11 +0000 (21:08 +0000)
committerfoobar <sniper@php.net>
Fri, 2 Sep 2005 21:08:11 +0000 (21:08 +0000)
       value in case setting the one from .ini file failed. (Andrei)

Zend/zend_ini.c

index 61976052e4d775a84c5f33cf8a9bf0eb03b63e22..072a843c7828411b0c09f990494d0e29e804faaa 100644 (file)
@@ -155,6 +155,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
        zend_ini_entry *hashed_ini_entry;
        zval default_value;
        HashTable *directives = registered_zend_ini_directives;
+       zend_bool config_directive_success = 0;
 
 #ifdef ZTS
        /* if we are called during the request, eg: from dl(),
@@ -172,6 +173,7 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
 
        while (p->name) {
                p->module_number = module_number;
+               config_directive_success = 0;
                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;
@@ -181,11 +183,12 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
                                || hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
                                hashed_ini_entry->value = default_value.value.str.val;
                                hashed_ini_entry->value_length = default_value.value.str.len;
+                               config_directive_success = 1;
                        }
-               } else {
-                       if (hashed_ini_entry->on_modify) {
-                               hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
-                       }
+               }
+
+               if (!config_directive_success && hashed_ini_entry->on_modify) {
+                       hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
                }
                p++;
        }