diff options
-rw-r--r-- | 87.patch | 148 | ||||
-rw-r--r-- | php-pecl-xhprof.spec | 36 |
2 files changed, 160 insertions, 24 deletions
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 <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) { diff --git a/php-pecl-xhprof.spec b/php-pecl-xhprof.spec index a754031..53e5007 100644 --- a/php-pecl-xhprof.spec +++ b/php-pecl-xhprof.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-xhprof # -# Copyright (c) 2012-2023 Remi Collet +# Copyright (c) 2012-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -27,13 +27,15 @@ Name: %{?scl_prefix}php-pecl-xhprof Version: 2.3.9 -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: PHP extension for XHProf, a Hierarchical Profiler License: Apache-2.0 URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{sources}.tgz +Patch0: 87.patch + # https://bugs.php.net/61262 ExclusiveArch: %{ix86} x86_64 aarch64 @@ -96,10 +98,12 @@ Documentation: %{pecl_docdir}/%{pecl_name}/xhprof_html/docs/index.html # xhprof_html should be web, but www_dir is /var/www/html # xhprof_lib should be php, really a lib sed -e 's/role="php"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml pushd %{sources}/extension +%patch -P0 -p2 + sed -e '/XHPROF_VERSION/s/2.3.5/%{version}/' -i php_xhprof.h # Sanity check, really often broken extver=$(sed -n '/#define XHPROF_VERSION/{s/.* "//;s/".*$//;p}' php_xhprof.h) @@ -218,28 +222,8 @@ REPORT_EXIT_STATUS=1 \ %endif -%if 0%{?fedora} < 24 && 0%{?rhel} < 8 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then - %{pecl_uninstall} %{pecl_name} >/dev/null || : -fi -%endif - - %files -%{?_licensedir:%license %{sources}/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %exclude %{pecl_docdir}/%{pecl_name}/examples %exclude %{pecl_docdir}/%{pecl_name}/xhprof_html @@ -263,6 +247,10 @@ fi %changelog +* Fri Jul 5 2024 Remi Collet <remi@remirepo.net> - 2.3.9-4 +- fix build with 8.4 using patch from + https://github.com/longxinH/xhprof/pull/87 + * Wed Aug 30 2023 Remi Collet <remi@remirepo.net> - 2.3.9-3 - rebuild for PHP 8.3.0RC1 |