summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Mausz <manuel@mausz.at>2017-06-09 01:43:08 +0200
committerManuel Mausz <manuel@mausz.at>2017-06-09 01:43:08 +0200
commitee0e6963f39cc8f30bbd5675a0c4880a18b63b00 (patch)
tree1db73609ab8dea419ce04c037ccb318af3900177
parent9997767dc381de43ed6e8e138306c163afad6119 (diff)
downloadphp-git-ee0e6963f39cc8f30bbd5675a0c4880a18b63b00.tar.gz
Fixed bug #74600
Make sure the hash entry is an array. The origin fix broke support for HOST/PATH ini sections. Only the beginning of the string has to match. Revert this check but use zend_binary_strncasecmp instead of strncasecmp.
-rw-r--r--main/php_ini.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main/php_ini.c b/main/php_ini.c
index 7d09fbcfad..cf9711fd67 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -280,7 +280,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
size_t key_len;
/* PATH sections */
- if (zend_string_equals_literal_ci(Z_STR_P(arg1), "PATH")) {
+ if (!zend_binary_strncasecmp(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), "PATH", sizeof("PATH") - 1, sizeof("PATH") - 1)) {
key = Z_STRVAL_P(arg1);
key = key + sizeof("PATH") - 1;
key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1;
@@ -291,7 +291,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
TRANSLATE_SLASHES_LOWER(key);
/* HOST sections */
- } else if (zend_string_equals_literal_ci(Z_STR_P(arg1), "HOST")) {
+ } else if (!zend_binary_strncasecmp(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), "HOST", sizeof("HOST") - 1, sizeof("HOST") - 1)) {
key = Z_STRVAL_P(arg1);
key = key + sizeof("HOST") - 1;
key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1;
@@ -328,7 +328,9 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
zend_hash_init(Z_ARRVAL(section_arr), 8, NULL, (dtor_func_t) config_zval_dtor, 1);
entry = zend_hash_str_update(target_hash, key, key_len, &section_arr);
}
- active_ini_hash = Z_ARRVAL_P(entry);
+ if (Z_TYPE_P(entry) == IS_ARRAY) {
+ active_ini_hash = Z_ARRVAL_P(entry);
+ }
}
}
break;