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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
From 195e97915a42d4c6c1d0fbe8e949a719b2cf3484 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 5 Jul 2024 15:18:48 +0200
Subject: [PATCH 1/5] Fix [-Wmemset-elt-size]
---
extension/xhprof.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/extension/xhprof.c b/extension/xhprof.c
index 15e5ac37..0b3df3c3 100755
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -393,7 +393,7 @@ void hp_ignored_functions_clear(hp_ignored_functions *functions)
hp_array_del(functions->names);
functions->names = NULL;
- memset(functions->filter, 0, XHPROF_MAX_IGNORED_FUNCTIONS);
+ memset(functions->filter, 0, sizeof(functions->filter));
efree(functions);
}
@@ -457,7 +457,7 @@ hp_ignored_functions *hp_ignored_functions_init(zval *values)
functions = emalloc(sizeof(hp_ignored_functions));
functions->names = names;
- memset(functions->filter, 0, XHPROF_MAX_IGNORED_FUNCTIONS);
+ memset(functions->filter, 0, sizeof(functions->filter));
uint32_t i = 0;
for (; names[i] != NULL; i++) {
From f5766d3b98963b347379a6bdb5008119f6d61b88 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 5 Jul 2024 15:23:44 +0200
Subject: [PATCH 2/5] Fix [-Wunused-but-set-variable] build warning
---
extension/xhprof.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/extension/xhprof.c b/extension/xhprof.c
index 0b3df3c3..520b5e73 100755
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -425,7 +425,6 @@ hp_ignored_functions *hp_ignored_functions_init(zval *values)
if (Z_TYPE_P(values) == IS_ARRAY) {
HashTable *ht;
- zend_ulong num_key;
zend_string *key;
zval *val;
@@ -434,7 +433,7 @@ hp_ignored_functions *hp_ignored_functions_init(zval *values)
names = ecalloc(count + 1, sizeof(zend_string *));
- ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, key, val) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
if (!key) {
if (Z_TYPE_P(val) == IS_STRING && strcmp(Z_STRVAL_P(val), ROOT_SYMBOL) != 0) {
/* do not ignore "main" */
From 857e385a151dfb06ec11a954ce518fa29049f2f8 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 5 Jul 2024 15:29:22 +0200
Subject: [PATCH 3/5] Fix php_pcre_match_impl call for 8.4
---
extension/xhprof.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/extension/xhprof.c b/extension/xhprof.c
index 520b5e73..054a4a44 100755
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -1286,11 +1286,16 @@ int hp_pcre_match(zend_string *pattern, const char *str, size_t len, zend_ulong
#if PHP_VERSION_ID < 70400
php_pcre_match_impl(pce_regexp, (char*)str, len, &matches, &subparts /* subpats */,
0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
-#else
+#elif PHP_VERSION_ID < 80400
zend_string *tmp = zend_string_init(str, len, 0);
php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
zend_string_release(tmp);
+#else
+ zend_string *tmp = zend_string_init(str, len, 0);
+ php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
+ false/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
+ zend_string_release(tmp);
#endif
if (!zend_hash_num_elements(Z_ARRVAL(subparts))) {
From f8f4d0c857125375ddf959a71e8b86cfac3fe00a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 5 Jul 2024 15:30:00 +0200
Subject: [PATCH 4/5] Fix [-Wunused-variable] warning
---
extension/xhprof.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/extension/xhprof.c b/extension/xhprof.c
index 054a4a44..0c6eeb86 100755
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -1273,7 +1273,6 @@ static inline void hp_array_del(zend_string **names)
int hp_pcre_match(zend_string *pattern, const char *str, size_t len, zend_ulong idx)
{
- zval *match;
pcre_cache_entry *pce_regexp;
if ((pce_regexp = pcre_get_compiled_regex_cache(pattern)) == NULL) {
From aff62dca0b36b61919cc3202438a369f57383d7e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 5 Jul 2024 15:39:34 +0200
Subject: [PATCH 5/5] Fix [-Wmaybe-uninitialized] warning
---
extension/xhprof.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/extension/xhprof.c b/extension/xhprof.c
index 0c6eeb86..add45383 100755
--- a/extension/xhprof.c
+++ b/extension/xhprof.c
@@ -1350,15 +1350,14 @@ zend_string *hp_trace_callback_sql_query
zend_string *hp_trace_callback_pdo_statement_execute(zend_string *symbol, zend_execute_data *data)
{
zend_string *result, *pattern;
- zend_class_entry *pdo_ce;
zval *object = (data->This.value.obj) ? &(data->This) : NULL;
zval *query_string, *arg;
if (object != NULL) {
#if PHP_VERSION_ID < 80000
- query_string = zend_read_property(pdo_ce, object, "queryString", sizeof("queryString") - 1, 0, NULL);
+ query_string = zend_read_property(NULL, object, "queryString", sizeof("queryString") - 1, 0, NULL);
#else
- query_string = zend_read_property(pdo_ce, Z_OBJ_P(object), "queryString", sizeof("queryString") - 1, 0, NULL);
+ query_string = zend_read_property(NULL, Z_OBJ_P(object), "queryString", sizeof("queryString") - 1, 0, NULL);
#endif
if (query_string == NULL || Z_TYPE_P(query_string) != IS_STRING) {
|