summaryrefslogtreecommitdiff
path: root/Zend/zend_ini.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2008-07-07 21:37:46 +0000
committerScott MacVicar <scottmac@php.net>2008-07-07 21:37:46 +0000
commit43e7784b0a11ad3cbe169cca494cdee98f65c84e (patch)
treea7a18856ea6d2c6ba748a9b6c7344fc163bc3020 /Zend/zend_ini.c
parent5c158c03ec5b31aa9a24d7e9870da2dba5b00592 (diff)
downloadphp-git-43e7784b0a11ad3cbe169cca494cdee98f65c84e.tar.gz
Add zend_ini_string_ex so that the you can differentiate between NULL as a value and its absence, this is important for ini_get. Related to bug #42657 and #43348
Diffstat (limited to 'Zend/zend_ini.c')
-rw-r--r--Zend/zend_ini.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index c773f0a05b..0e82a20b71 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -367,18 +367,23 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ *
}
/* }}} */
-ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */
+ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists) /* {{{ */
{
zend_ini_entry *ini_entry;
TSRMLS_FETCH();
if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry) == SUCCESS) {
+ if (exists) {
+ *exists = 1;
+ }
+
if (orig && ini_entry->modified) {
- return ini_entry->orig_value ? ini_entry->orig_value : "";
+ return ini_entry->orig_value;
} else {
- return ini_entry->value ? ini_entry->value : "";
+ return ini_entry->value;
}
- } else {
+ } else if (exists) {
+ *exists = 0;
return NULL;
}
@@ -386,6 +391,21 @@ ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */
}
/* }}} */
+ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */
+{
+ zend_bool exists = 1;
+ char *return_value;
+
+ return_value = zend_ini_string_ex(name, name_length, orig, &exists);
+ if (!exists) {
+ return NULL;
+ } else if (!return_value) {
+ return_value = "";
+ }
+ return return_value;
+}
+/* }}} */
+
#if TONY_20070307
static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */
{