diff --git a/configs/yaf_config_ini.c b/configs/yaf_config_ini.c index 8e87fa87..d65996ff 100644 --- a/configs/yaf_config_ini.c +++ b/configs/yaf_config_ini.c @@ -81,7 +81,7 @@ static zval* yaf_config_ini_get(yaf_config_object *conf, zend_string *name) /* { char *seg, *delim; size_t len; HashTable *target; - + if (conf->config == NULL) { return NULL; } @@ -298,7 +298,7 @@ static void yaf_config_ini_parser_cb(zval *key, zval *value, zval *index, int ca YAF_CONFIG_PARSER_FLAG() = YAF_CONFIG_INI_PARSING_END; return; } - + p = Z_STRVAL_P(key); l = Z_STRLEN_P(key); @@ -387,6 +387,9 @@ int yaf_config_ini_init(yaf_config_object *conf, zval *filename, zend_string *se return 0; } } + + // done + zend_destroy_file_handle(&fh); } else { yaf_trigger_error(E_ERROR, "Argument is not a valid ini file '%s'", ini_file); return 0; diff --git a/tests/110.phpt b/tests/110.phpt new file mode 100644 index 00000000..f962db60 --- /dev/null +++ b/tests/110.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug (open file not destroy or crash in Yaf_Config_Ini, PHP 8.1 or later) +--SKIPIF-- + +--INI-- +yaf.use_spl_autoload=0 +yaf.lowcase_path=0 +yaf.use_namespace=0 +--FILE-- + +--EXPECTF-- +string(4) "Done" \ No newline at end of file