summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-12-23 14:58:16 +0100
committerRemi Collet <remi@php.net>2021-12-23 14:58:16 +0100
commit8c2f31f53ec65735658f91e9084ff319cbb664b0 (patch)
treee08952a86cc2ab6bf806a494eabcc277ebed07b3
parente47a2c4eb5571dd1caa5fb95211ef8d68f6a65af (diff)
update to 1.5.0
add dependency on json extension add patch to allow build with shared json from https://github.com/scoutapp/scout-apm-php-ext/pull/99
-rw-r--r--99.patch35
-rw-r--r--PHPINFO2
-rw-r--r--REFLECTION2
-rw-r--r--php-pecl-scoutapm.spec27
4 files changed, 58 insertions, 8 deletions
diff --git a/99.patch b/99.patch
new file mode 100644
index 0000000..a0f740a
--- /dev/null
+++ b/99.patch
@@ -0,0 +1,35 @@
+From cf2e24d788d9d31715c272197417cb03283acd40 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 23 Dec 2021 14:43:51 +0100
+Subject: [PATCH] call json_encode using call_user_func on PHP 7
+
+---
+ scout_utils.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/scout_utils.c b/scout_utils.c
+index 424c782..ea975db 100644
+--- a/scout_utils.c
++++ b/scout_utils.c
+@@ -89,11 +89,21 @@ void safely_copy_argument_zval_as_scalar(zval *original_to_copy, zval *destinati
+ if (strcasecmp("stream-context", zend_rsrc_list_get_rsrc_type(Z_RES_P(original_to_copy))) == 0) {
+ php_stream_context *stream_context = zend_fetch_resource_ex(original_to_copy, NULL, php_le_stream_context());
+ if (stream_context != NULL) {
++#if PHP_VERSION_ID < 80000
++ /* ext/json can be shared */
++ zval args[1], jsonenc;
++
++ ZVAL_STRINGL(&jsonenc, "json_encode", sizeof("json_encode")-1);
++ args[0] = stream_context->options;
++ call_user_function(EG(function_table), NULL, &jsonenc, destination, 1, args);
++#else
++ /* ext/json is always there */
+ smart_str json_encode_string_buffer = {0};
+ php_json_encode(&json_encode_string_buffer, &stream_context->options, 0);
+ smart_str_0(&json_encode_string_buffer);
+ ZVAL_STR_COPY(destination, json_encode_string_buffer.s);
+ smart_str_free(&json_encode_string_buffer);
++#endif
+ return;
+ }
+ }
diff --git a/PHPINFO b/PHPINFO
index 90c14de..44b51d0 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -2,7 +2,7 @@
scoutapm
scoutapm support => enabled
-Version => 1.4.3
+Version => 1.5.0
curl functions => Yes
file functions => Yes
pdo functions => Yes
diff --git a/REFLECTION b/REFLECTION
index 451b1b0..4c5e272 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,4 +1,4 @@
-Extension [ <persistent> extension #129 scoutapm version 1.4.3 ] {
+Extension [ <persistent> extension #120 scoutapm version 1.5.0 ] {
- Functions {
Function [ <internal:scoutapm> function scoutapm_get_calls ] {
diff --git a/php-pecl-scoutapm.spec b/php-pecl-scoutapm.spec
index 1808137..e29d041 100644
--- a/php-pecl-scoutapm.spec
+++ b/php-pecl-scoutapm.spec
@@ -17,24 +17,28 @@
Summary: Native Extension Component for ScoutAPM's PHP Agent
Name: %{?sub_prefix}php-pecl-%{pecl_name}
-Version: 1.4.3
-Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Version: 1.5.0
+Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
License: PHP
URL: https://pecl.php.net/package/%{pecl_name}
+Patch0: https://patch-diff.githubusercontent.com/raw/scoutapp/scout-apm-php-ext/pull/99.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.1
BuildRequires: %{?scl_prefix}php-devel < 8.1
BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: %{?scl_prefix}php-json
# Only for tests
BuildRequires: %{?scl_prefix}php-curl
BuildRequires: %{?scl_prefix}php-pdo
BuildRequires: %{?scl_prefix}php-pdo_sqlite
BuildRequires: libcurl-devel
-BuildRequires: %{_bindir}/ps
+BuildRequires: /bin/ps
+Requires: %{?scl_prefix}php-json%{?_isa}
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
@@ -79,6 +83,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
pushd NTS
+%patch0 -p1 -b .pr99
+
: Check version
extver=$(sed -n '/#define PHP_SCOUTAPM_VERSION /{s/.* "//;s/".*$//;p}' zend_scoutapm.h)
if test "x${extver}" != "x%{version}%{?prever}"; then
@@ -165,19 +171,22 @@ fi
%check
+DEPS="-n"
+[ -f %{php_extdir}/json.so ] && DEPS="$DEPS -d extension=json.so"
+
# Minimal load test for NTS extension
-%{__php} --no-php-ini \
+%{__php} $DEPS \
--define zend_extension=$PWD/NTS/modules/%{pecl_name}.so \
--modules | grep '^%{pecl_name}$'
%if %{with_zts}
# Minimal load test for ZTS extension
-%{__ztsphp} --no-php-ini \
+%{__ztsphp} $DEPS \
--define zend_extension=$PWD/ZTS/modules/%{pecl_name}.so \
--modules | grep '^%{pecl_name}$'
%endif
-DEPS="-n -d extension=curl.so -d extension=pdo.so -d extension=pdo_sqlite.so"
+DEPS="$DEPS -d extension=curl.so -d extension=pdo.so -d extension=pdo_sqlite.so"
: Upstream test suite for NTS extension
cd NTS
@@ -209,6 +218,12 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Thu Dec 23 2021 Remi Collet <remi@remirepo.net> - 1.5.0-1
+- update to 1.5.0
+- add dependency on json extension
+- add patch to allow build with shared json from
+ https://github.com/scoutapp/scout-apm-php-ext/pull/99
+
* Fri Nov 5 2021 Remi Collet <remi@remirepo.net> - 1.4.3-2
- EL-9 build