diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-09-15 17:08:58 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-09-15 17:08:58 +0200 |
commit | 6da3a1e3ce8726054f87f6cc63210bf4760c680d (patch) | |
tree | 6106d69fc735e12f6e381101de37e7b9803e5d23 /ext/standard/basic_functions.c | |
parent | 3f3e914df33793a36f51b4e44745d6a5aec4f685 (diff) | |
download | php-git-6da3a1e3ce8726054f87f6cc63210bf4760c680d.tar.gz |
Revert "Implement #67331: Have parse_ini_file add empty entries"
This reverts commit 3f3e914df33793a36f51b4e44745d6a5aec4f685.
The commit broke some tests on Windows, and generally needs more
though.
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r-- | ext/standard/basic_functions.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 68f9014016..160e510831 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5976,6 +5976,10 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal switch (callback_type) { case ZEND_INI_PARSER_ENTRY: + if (!arg2) { + /* bare string - nothing to do */ + break; + } Z_TRY_ADDREF_P(arg2); zend_symtable_update(Z_ARRVAL_P(arr), Z_STR_P(arg1), arg2); break; @@ -5984,6 +5988,11 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal { zval hash, *find_hash; + if (!arg2) { + /* bare string - nothing to do */ + break; + } + 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) { zend_ulong key = (zend_ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) { @@ -6024,7 +6033,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, if (callback_type == ZEND_INI_PARSER_SECTION) { array_init(&BG(active_ini_file_section)); zend_symtable_update(Z_ARRVAL_P(arr), Z_STR_P(arg1), &BG(active_ini_file_section)); - } else { + } else if (arg2) { zval *active_arr; if (Z_TYPE(BG(active_ini_file_section)) != IS_UNDEF) { |