Skip to content

Commit 4213b5d

Browse files
committed
tolerate uninitialized ini settings in php_ini_{long,double,string}()
1 parent 483caf3 commit 4213b5d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

main/php_ini.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ long php_ini_long(char *name, uint name_length, int orig)
189189

190190
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
191191
if (orig && ini_entry->orig_value) {
192-
return (long) atoi(ini_entry->orig_value);
193-
} else {
194-
return (long) atoi(ini_entry->value);
192+
return strtol(ini_entry->orig_value, NULL, 0);
193+
} else if (ini_entry->value) {
194+
return strtol(ini_entry->value, NULL, 0);
195195
}
196196
}
197197

@@ -206,7 +206,7 @@ double php_ini_double(char *name, uint name_length, int orig)
206206
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
207207
if (orig && ini_entry->orig_value) {
208208
return (double) strtod(ini_entry->orig_value, NULL);
209-
} else {
209+
} else if (ini_entry->value) {
210210
return (double) strtod(ini_entry->value, NULL);
211211
}
212212
}
@@ -222,7 +222,7 @@ char *php_ini_string(char *name, uint name_length, int orig)
222222
if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
223223
if (orig && ini_entry->orig_value) {
224224
return ini_entry->orig_value;
225-
} else {
225+
} else if (ini_entry->value) {
226226
return ini_entry->value;
227227
}
228228
}

0 commit comments

Comments
 (0)