diff options
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r-- | ext/standard/basic_functions.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index fe672d0fa5..4ca820ddf0 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -6130,12 +6130,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, *element = *arg2; zval_copy_ctor(element); INIT_PZVAL(element); - if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL); - } else { - ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); - zend_hash_index_update(Z_ARRVAL_P(arr), key, &element, sizeof(zval *), NULL); - } + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL); break; case ZEND_INI_PARSER_POP_ENTRY: @@ -6147,17 +6142,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, break; } - if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { - if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void **) &find_hash) == FAILURE) { - ALLOC_ZVAL(hash); - INIT_PZVAL(hash); - array_init(hash); - - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &hash, sizeof(zval *), NULL); - } else { - hash = *find_hash; - } - } else { + if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0]=='0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); if (zend_hash_index_find(Z_ARRVAL_P(arr), key, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); @@ -6168,6 +6153,16 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, } else { hash = *find_hash; } + } else { + if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void **) &find_hash) == FAILURE) { + ALLOC_ZVAL(hash); + INIT_PZVAL(hash); + array_init(hash); + + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &hash, sizeof(zval *), NULL); + } else { + hash = *find_hash; + } } if (Z_TYPE_P(hash) != IS_ARRAY) { @@ -6196,12 +6191,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback if (callback_type == ZEND_INI_PARSER_SECTION) { MAKE_STD_ZVAL(BG(active_ini_file_section)); array_init(BG(active_ini_file_section)); - if (is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) != IS_LONG) { - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL); - } else { - ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); - zend_hash_index_update(Z_ARRVAL_P(arr), key, &BG(active_ini_file_section), sizeof(zval *), NULL); - } + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL); } else if (arg2) { zval *active_arr; |