?? ??? ????, PHP 7.4.4
+- Core:
+ . Fixed bug #79244 (php crashes during parsing INI file). (Laruence)
+
- COM:
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
(cmb)
--- /dev/null
+--TEST--
+BUG #77589 (Core dump using parse_ini_string with numeric sections)
+--FILE--
+<?php
+var_dump(
+ parse_ini_string(<<<INI
+[0]
+a = 1
+b = on
+c = true
+
+["true"]
+a = 100
+b = null
+c = yes
+INI
+, TRUE, INI_SCANNER_TYPED));
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ bool(true)
+ ["c"]=>
+ bool(true)
+ }
+ ["true"]=>
+ array(3) {
+ ["a"]=>
+ int(100)
+ ["b"]=>
+ NULL
+ ["c"]=>
+ bool(true)
+ }
+}
ZVAL_NEW_STR(retval, zend_string_init(str, len, ZEND_SYSTEM_INI))
-#define RETURN_TOKEN(type, str, len) { \
- if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED) { \
- zend_ini_copy_typed_value(ini_lval, type, str, len); \
- } else { \
- zend_ini_copy_value(ini_lval, str, len); \
- } \
- return type; \
+#define RETURN_TOKEN(type, str, len) { \
+ if (SCNG(scanner_mode) == ZEND_INI_SCANNER_TYPED && \
+ (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW))) {\
+ zend_ini_copy_typed_value(ini_lval, type, str, len); \
+ } else { \
+ zend_ini_copy_value(ini_lval, str, len); \
+ } \
+ return type; \
}
static inline int convert_to_number(zval *retval, const char *str, const int str_len)