1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

zend_ini: Implement zend_ini_string*() in terms of zend_ini_str*() (#17530)

This commit is contained in:
Tim Düsterhus
2025-01-20 22:15:23 +01:00
committed by GitHub
parent ce53dab272
commit 0f8340d0a5

View File

@@ -480,40 +480,17 @@ ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig)
ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig, bool *exists) /* {{{ */
{
zend_ini_entry *ini_entry;
zend_string *str = zend_ini_str_ex(name, name_length, orig, exists);
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
if (exists) {
*exists = 1;
}
if (orig && ini_entry->modified) {
return ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL;
} else {
return ini_entry->value ? ZSTR_VAL(ini_entry->value) : NULL;
}
} else {
if (exists) {
*exists = 0;
}
return NULL;
}
return str ? ZSTR_VAL(str) : NULL;
}
/* }}} */
ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig) /* {{{ */
{
bool exists = 1;
char *return_value;
zend_string *str = zend_ini_str(name, name_length, orig);
return_value = zend_ini_string_ex(name, name_length, orig, &exists);
if (!exists) {
return NULL;
} else if (!return_value) {
return_value = "";
}
return return_value;
return str ? ZSTR_VAL(str) : NULL;
}
/* }}} */