summaryrefslogtreecommitdiffstats
path: root/66.patch
blob: beaf8be234e4284882589516627bd3273c14fe05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 9ecaca42f0d168340e9f064c6756cd2404a090c6 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
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);
 				}