diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | php-pecl-stomp.spec | 42 | ||||
-rw-r--r-- | stomp-upstream.patch (renamed from stomp-php8.patch) | 104 |
4 files changed, 140 insertions, 10 deletions
@@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #146 Stomp version 2.0.2 ] { +Extension [ <persistent> extension #124 Stomp version 2.0.2 ] { - INI { Entry [ stomp.default_broker <ALL> ] diff --git a/php-pecl-stomp.spec b/php-pecl-stomp.spec index 5f16bb2..0584a75 100644 --- a/php-pecl-stomp.spec +++ b/php-pecl-stomp.spec @@ -9,6 +9,9 @@ %{?scl: %scl_package php-pecl-stomp} %{!?scl: %global _root_prefix %{_prefix}} +# to run full test suite using a rabbitmq server +%bcond_with tests + %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name stomp %global ini_name 40-%{pecl_name}.ini @@ -16,18 +19,21 @@ Summary: Stomp client extension Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 2.0.2 -Release: 6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 7%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz -Patch0: %{pecl_name}-php8.patch +Patch0: %{pecl_name}-upstream.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: make BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pear BuildRequires: openssl-devel +%if %{with tests} +BuildRequires: rabbitmq-server +%endif Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -79,7 +85,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 -b .pr14 +%patch0 -p1 -b .upstream # Sanity check, really often broken extver=$(sed -n '/#define PHP_STOMP_VERSION/{s/.* "//;s/".*$//;p}' php_stomp.h) @@ -117,11 +123,7 @@ EOF peclbuild() { %configure \ --enable-stomp \ -%if "%{php_version}" > "7.4" - --with-openssl \ -%else --with-openssl-dir=%{_root_prefix} \ -%endif --with-libdir=%{_lib} \ --with-php-config=$1 @@ -198,11 +200,30 @@ fi %endif cd NTS -# need a server, such as rabbitmq-server +%if %{with tests} +mkdir log run base +: Launch the RabbitMQ service +export RABBITMQ_PID_FILE=$PWD/run/pid +export RABBITMQ_LOG_BASE=$PWD/log +export RABBITMQ_MNESIA_BASE=$PWD/base +/usr/lib/rabbitmq/bin/rabbitmq-server &>log/output & +/usr/lib/rabbitmq/bin/rabbitmqctl wait $RABBITMQ_PID_FILE +%endif + : Run upstream test suite +ret=0 TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ -%{__php} -n run-tests.php -q --show-diff +%{__php} -n run-tests.php -q --show-diff || ret=1 + +%if %{with tests} +if [ -s $RABBITMQ_PID_FILE ]; then + kill $(cat $RABBITMQ_PID_FILE) +fi +rm -rf log run base +%endif + +exit $ret %files @@ -220,6 +241,9 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ %changelog +* Mon Sep 27 2021 Remi Collet <remi@remirepo.net> - 2.0.2-7 +- more upstream patches + * Mon Sep 27 2021 Remi Collet <remi@remirepo.net> - 2.0.2-6 - add patch for PHP 8 from https://github.com/php/pecl-tools-stomp/pull/14 diff --git a/stomp-php8.patch b/stomp-upstream.patch index 46b1f09..c356df7 100644 --- a/stomp-php8.patch +++ b/stomp-upstream.patch @@ -1637,3 +1637,107 @@ index a6a9b4a..c22dedf 100644 ["sec"]=> int(10) +From 5e438eaa570cf73c323026da58ddeae13a9daacf Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Mon, 27 Sep 2021 15:40:19 +0200 +Subject: [PATCH] allow NULL for transaction_id + +--- + php_stomp.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/php_stomp.c b/php_stomp.c +index b99a9ff..8e96b20 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -1042,13 +1042,13 @@ static void _php_stomp_transaction(INTERNAL_FUNCTION_PARAMETERS, char *cmd, size + zval *headers = NULL, rv; + + if (stomp_object) { +- if (zend_parse_parameters(ZEND_NUM_ARGS() , "S|a", &transaction_id, &headers) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS() , "S!|a", &transaction_id, &headers) == FAILURE) { + return; + } + FETCH_STOMP_OBJECT; + } else { + zval *arg; +- if (zend_parse_parameters(ZEND_NUM_ARGS() , "rS|a", &arg, &transaction_id, &headers) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS() , "rS!|a", &arg, &transaction_id, &headers) == FAILURE) { + return; + } + FETCH_STOMP_RSRC(stomp, arg); +@@ -1056,7 +1056,7 @@ static void _php_stomp_transaction(INTERNAL_FUNCTION_PARAMETERS, char *cmd, size + + INIT_FRAME_L(frame, cmd, cmd_len); + +- if (ZSTR_LEN(transaction_id)) { ++ if (transaction_id && ZSTR_LEN(transaction_id)) { + ZVAL_STR(&rv, zend_string_copy(transaction_id)); + zend_hash_str_add(frame.headers, "transaction", sizeof("transaction") - 1, &rv); + } +From 8c96bd7d77b0dd375d0a644f0847d6ca6270adf9 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Mon, 27 Sep 2021 15:40:49 +0200 +Subject: [PATCH] don't use NULL for integer + +--- + tests/010-timeout/001.phpt | 2 +- + tests/010-timeout/002.phpt | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/010-timeout/001.phpt b/tests/010-timeout/001.phpt +index b9886db..15fe931 100644 +--- a/tests/010-timeout/001.phpt ++++ b/tests/010-timeout/001.phpt +@@ -44,7 +44,7 @@ try { + var_dump($s->getReadTimeout()); + + // Set read timout with the params as null +-var_dump($s->setReadTimeout(null, null)); ++var_dump($s->setReadTimeout(0, 0)); + // Fifth test, read supposed to get the last value set : 0.0 + var_dump($s->getReadTimeout()); + +diff --git a/tests/010-timeout/002.phpt b/tests/010-timeout/002.phpt +index c22dedf..b7da6c7 100644 +--- a/tests/010-timeout/002.phpt ++++ b/tests/010-timeout/002.phpt +@@ -46,7 +46,7 @@ try { + var_dump(stomp_get_read_timeout($link)); + + // Set read timout with the params as null +-var_dump(stomp_set_read_timeout($link, null, null)); ++var_dump(stomp_set_read_timeout($link, 0, 0)); + // Fifth test, read supposed to get the last value set : 0.0 + var_dump(stomp_get_read_timeout($link)); + +From 380e82bba1567bac80264b212bbb9df040b48a56 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Mon, 27 Sep 2021 16:01:59 +0200 +Subject: [PATCH] only add the ack if not already in the headers + +--- + php_stomp.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/php_stomp.c b/php_stomp.c +index 8e96b20..11cf006 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -805,10 +805,13 @@ PHP_FUNCTION(stomp_subscribe) + FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers)); + } + +- /* Add the destination */ +- ZVAL_STRINGL(&rv, "client", sizeof("client") - 1); +- zend_hash_str_update(frame.headers, "ack", sizeof("ack") - 1, &rv); ++ /* Add the ack if not already in the headers */ ++ if (!zend_hash_str_find(frame.headers, ZEND_STRL("ack"))) { ++ ZVAL_STRINGL(&rv, "client", sizeof("client") - 1); ++ zend_hash_str_update(frame.headers, "ack", sizeof("ack") - 1, &rv); ++ } + ++ /* Add the destination */ + ZVAL_STR(&rv, zend_string_copy(destination)); + zend_hash_str_update(frame.headers, "destination", sizeof("destination") - 1, &rv); + /* zend_hash_str_add_ptr(frame.headers, ZEND_STRL("activemq.prefetchSize"), estrdup("1")); */ |