From 9ecaca42f0d168340e9f064c6756cd2404a090c6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 30 Nov 2021 10:01:15 +0100 Subject: [PATCH] zend_string instead of char * on PHP 8.1 --- yaconf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/yaconf.c b/yaconf.c index a4869c7..9431aa7 100644 --- a/yaconf.c +++ b/yaconf.c @@ -613,7 +613,11 @@ PHP_MINIT_FUNCTION(yaconf) if (S_ISREG(sb.st_mode)) { yaconf_filenode node; if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) { +#if PHP_VERSION_ID >= 80100 + fh.filename = zend_string_init(ini_file, strlen(ini_file), 0); +#else fh.filename = ini_file; +#endif fh.type = ZEND_HANDLE_FP; ZVAL_UNDEF(&active_ini_file_section); YACONF_G(parse_err) = 0; @@ -623,8 +627,14 @@ PHP_MINIT_FUNCTION(yaconf) YACONF_G(parse_err) = 0; php_yaconf_hash_destroy(Z_ARRVAL(result)); free(namelist[i]); +#if PHP_VERSION_ID >= 80100 + zend_string_release(fh.filename); +#endif continue; } +#if PHP_VERSION_ID >= 80100 + zend_string_release(fh.filename); +#endif } php_yaconf_symtable_update(ini_containers, namelist[i]->d_name, p - namelist[i]->d_name, &result); @@ -703,7 +713,11 @@ PHP_RINIT_FUNCTION(yaconf) } if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) { +#if PHP_VERSION_ID >= 80100 + fh.filename = zend_string_init(ini_file, strlen(ini_file), 0); +#else fh.filename = ini_file; +#endif fh.type = ZEND_HANDLE_FP; ZVAL_UNDEF(&active_ini_file_section); YACONF_G(parse_err) = 0; @@ -713,6 +727,9 @@ PHP_RINIT_FUNCTION(yaconf) YACONF_G(parse_err) = 0; php_yaconf_hash_destroy(Z_ARRVAL(result)); free(namelist[i]); +#if PHP_VERSION_ID >= 80100 + zend_string_release(fh.filename); +#endif continue; } } @@ -734,6 +751,9 @@ PHP_RINIT_FUNCTION(yaconf) zend_hash_update_mem(parsed_ini_files, n.filename, &n, sizeof(yaconf_filenode)); } free(namelist[i]); +#if PHP_VERSION_ID >= 80100 + zend_string_release(fh.filename); +#endif } free(namelist); }