mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- allow to use "yes" and "true" with ini_set() and in commandline (through -d flag)
- fix #15854 that was caused by wrong consideration that zend_ini_boolean_displayer_cb() always recieves converted to "0"/"1" values.
This commit is contained in:
parent
ce972676b5
commit
1c68938c60
2 changed files with 33 additions and 6 deletions
2
NEWS
2
NEWS
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue