]> granicus.if.org Git - php/commitdiff
tolerate uninitialized ini settings in php_ini_{long,double,string}()
authorStig Bakken <ssb@php.net>
Mon, 12 Apr 1999 16:35:25 +0000 (16:35 +0000)
committerStig Bakken <ssb@php.net>
Mon, 12 Apr 1999 16:35:25 +0000 (16:35 +0000)
main/php_ini.c

index 384422eddb9cc47f7f5d832a0378e2f01e845c9c..a8fe29924934019c46795bd56b1d5b4d0a3db3bb 100644 (file)
@@ -189,9 +189,9 @@ long php_ini_long(char *name, uint name_length, int orig)
 
        if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
                if (orig && ini_entry->orig_value) {
-                       return (long) atoi(ini_entry->orig_value);
-               } else {
-                       return (long) atoi(ini_entry->value);
+                       return strtol(ini_entry->orig_value, NULL, 0);
+               } else if (ini_entry->value) {
+                       return strtol(ini_entry->value, NULL, 0);
                }
        }
 
@@ -206,7 +206,7 @@ double php_ini_double(char *name, uint name_length, int orig)
        if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
                if (orig && ini_entry->orig_value) {
                        return (double) strtod(ini_entry->orig_value, NULL);
-               } else {
+               } else if (ini_entry->value) {
                        return (double) strtod(ini_entry->value, NULL);
                }
        }
@@ -222,7 +222,7 @@ char *php_ini_string(char *name, uint name_length, int orig)
        if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
                if (orig && ini_entry->orig_value) {
                        return ini_entry->orig_value;
-               } else {
+               } else if (ini_entry->value) {
                        return ini_entry->value;
                }
        }