1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00

MFB: 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:56:34 +00:00
parent 5569fd3005
commit 8c94e4045d
2 changed files with 15 additions and 11 deletions
+10 -8
View File
@@ -438,14 +438,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;
}
+5 -3
View File
@@ -338,6 +338,10 @@ 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)) {
@@ -348,13 +352,11 @@ 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;
}