Refactor code to make fixes for coverity issues #385 and #386 a bit more

obvious
This commit is contained in:
Ilia Alshanetsky 2007-10-01 14:51:11 +00:00
parent 25be330cd0
commit 086289983e
2 changed files with 17 additions and 12 deletions

View File

@ -437,14 +437,16 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */
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 if (tmp_value) {
value = atoi(tmp_value);
if (tmp_value) {
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 (tmp_value) {
value = atoi(tmp_value);
}
} else {
value = 0;
}

View File

@ -218,7 +218,11 @@ static PHP_INI_MH(OnUpdateTimeout)
static int php_get_display_errors_mode(char *value, int value_length)
{
int mode;
if (!value) {
return PHP_DISPLAY_ERRORS_STDOUT;
}
if (value_length == 2 && !strcasecmp("on", value)) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
} else if (value_length == 3 && !strcasecmp("yes", value)) {
@ -229,14 +233,13 @@ static int php_get_display_errors_mode(char *value, int value_length)
mode = PHP_DISPLAY_ERRORS_STDERR;
} else if (value_length == 6 && !strcasecmp(value, "stdout")) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
} else if (value) {
} else {
mode = atoi(value);
if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) {
mode = PHP_DISPLAY_ERRORS_STDOUT;
}
} else {
mode = PHP_DISPLAY_ERRORS_STDOUT;
}
return mode;
}
/* }}} */