diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/zend_ini.c | 37 |
2 files changed, 33 insertions, 6 deletions
@@ -4,6 +4,8 @@ PHP NEWS - Fixed bug #33427 (ext/odbc: check if unixODBC header file exists). (Jani) - Fixed bug #33257 (array_splice() inconsistent when passed function instead of variable). (Dmitry) +- Fixed bug #15854 (boolean ini options may be incorrectly displayed as Off + when they are On). (Tony) 21 Jun 2005, PHP 5.1 Beta 2 - Improved PHP extension loading mechanism with support for module dependencies diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index aedc1e14ad..3de2f8de0c 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -371,15 +371,33 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) ZEND_INI_DISP(zend_ini_boolean_displayer_cb) { - int value; + int value, tmp_value_len; + char *tmp_value; if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = (ini_entry->orig_value ? atoi(ini_entry->orig_value) : 0); + tmp_value = (ini_entry->orig_value ? ini_entry->orig_value : NULL ); + tmp_value_len = ini_entry->orig_value_length; } else if (ini_entry->value) { - value = atoi(ini_entry->value); + tmp_value = ini_entry->value; + tmp_value_len = ini_entry->value_length; } else { - value = 0; + tmp_value = NULL; + tmp_value_len = 0; } + + if (tmp_value_len == 4 && strcasecmp(tmp_value, "true") == 0) { + value = 1; + } + else if (tmp_value_len == 3 && strcasecmp(tmp_value, "yes") == 0) { + value = 1; + } + else if (tmp_value_len == 2 && strcasecmp(tmp_value, "on") == 0) { + value = 1; + } + else { + value = atoi(tmp_value); + } + if (value) { ZEND_PUTS("On"); } else { @@ -452,9 +470,16 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) p = (zend_bool *) (base+(size_t) mh_arg1); - if (new_value_length==2 && strcasecmp("on", new_value)==0) { + if (new_value_length==2 && strcasecmp("on", new_value)==0) { *p = (zend_bool) 1; - } else { + } + else if (new_value_length==3 && strcasecmp("yes", new_value)==0) { + *p = (zend_bool) 1; + } + else if (new_value_length==4 && strcasecmp("true", new_value)==0) { + *p = (zend_bool) 1; + } + else { *p = (zend_bool) atoi(new_value); } return SUCCESS; |