From 70c6bdf13f754797a27a0ef31efce21ea0c23c5b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 5 Jul 2024 15:50:05 +0200 Subject: fix build with 8.4 using patch from https://github.com/longxinH/xhprof/pull/87 --- 87.patch | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 87.patch (limited to '87.patch') diff --git a/87.patch b/87.patch new file mode 100644 index 0000000..e8c4afb --- /dev/null +++ b/87.patch @@ -0,0 +1,148 @@ +From 195e97915a42d4c6c1d0fbe8e949a719b2cf3484 Mon Sep 17 00:00:00 2001 +From: Remi Collet +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 +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 +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 +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 +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) { -- cgit