Skip to content

Commit ee0e696

Browse files
committed
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.
1 parent 9997767 commit ee0e696

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main/php_ini.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
280280
size_t key_len;
281281

282282
/* PATH sections */
283-
if (zend_string_equals_literal_ci(Z_STR_P(arg1), "PATH")) {
283+
if (!zend_binary_strncasecmp(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), "PATH", sizeof("PATH") - 1, sizeof("PATH") - 1)) {
284284
key = Z_STRVAL_P(arg1);
285285
key = key + sizeof("PATH") - 1;
286286
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
291291
TRANSLATE_SLASHES_LOWER(key);
292292

293293
/* HOST sections */
294-
} else if (zend_string_equals_literal_ci(Z_STR_P(arg1), "HOST")) {
294+
} else if (!zend_binary_strncasecmp(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), "HOST", sizeof("HOST") - 1, sizeof("HOST") - 1)) {
295295
key = Z_STRVAL_P(arg1);
296296
key = key + sizeof("HOST") - 1;
297297
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
328328
zend_hash_init(Z_ARRVAL(section_arr), 8, NULL, (dtor_func_t) config_zval_dtor, 1);
329329
entry = zend_hash_str_update(target_hash, key, key_len, &section_arr);
330330
}
331-
active_ini_hash = Z_ARRVAL_P(entry);
331+
if (Z_TYPE_P(entry) == IS_ARRAY) {
332+
active_ini_hash = Z_ARRVAL_P(entry);
333+
}
332334
}
333335
}
334336
break;

0 commit comments

Comments
 (0)