Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions Zend/zend_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/* }}} */

Expand Down
Loading