From 72ecd8910ffe30b3701891ec8e54265585f03bbb Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 29 Jun 2018 09:44:32 +0200 Subject: add upstream patch for PHP 7.3 --- 9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch | 105 +++++++++++++++++++++++++ PHPINFO | 15 ++++ REFLECTION | 2 +- php-pecl-stomp.spec | 24 +++--- 4 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch create mode 100644 PHPINFO diff --git a/9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch b/9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch new file mode 100644 index 0000000..9329551 --- /dev/null +++ b/9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch @@ -0,0 +1,105 @@ +From 9f0f5e450b0c27a565d9ffc5644be9cdc8345d71 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 29 Jun 2018 09:36:49 +0200 +Subject: [PATCH] fix for 7.3 php_url fields are zend_string + some -Wformat + issues + +--- + php_stomp.c | 18 +++++++++++++----- + stomp.c | 4 ++-- + 2 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/php_stomp.c b/php_stomp.c +index 0213d13..7a6de74 100644 +--- a/php_stomp.c ++++ b/php_stomp.c +@@ -75,7 +75,7 @@ + efree(frame.headers); + + #define THROW_STOMP_EXCEPTION(excobj, errnum, error) \ +- ZVAL_OBJ(excobj, zend_throw_exception_ex(stomp_ce_exception, errnum , error)); ++ ZVAL_OBJ(excobj, zend_throw_exception_ex(stomp_ce_exception, errnum, "%s", error)); + + #define STOMP_ERROR(errno, msg) \ + STOMP_G(error_no) = errno; \ +@@ -101,6 +101,12 @@ + } \ + } + ++#if PHP_VERSION_ID < 70300 ++#define STOMP_URL_STR(a) (a) ++#else ++#define STOMP_URL_STR(a) ZSTR_VAL(a) ++#endif ++ + static int le_stomp; + static zend_object_handlers stomp_obj_handlers; + +@@ -484,7 +490,7 @@ PHP_FUNCTION(stomp_connect) + zend_string_release(broker); + + if (url_parts->scheme) { +- if (strcmp(url_parts->scheme, "ssl") == 0) { ++ if (strcmp(STOMP_URL_STR(url_parts->scheme), "ssl") == 0) { + #if HAVE_STOMP_SSL + use_ssl = 1; + #else +@@ -492,7 +498,7 @@ PHP_FUNCTION(stomp_connect) + php_url_free(url_parts); + return; + #endif +- } else if (strcmp(url_parts->scheme, "tcp") != 0) { ++ } else if (strcmp(STOMP_URL_STR(url_parts->scheme), "tcp") != 0) { + STOMP_ERROR(0, PHP_STOMP_ERR_INVALID_BROKER_URI_SCHEME); + php_url_free(url_parts); + return; +@@ -510,7 +516,7 @@ PHP_FUNCTION(stomp_connect) + stomp->options.connect_timeout_sec = STOMP_G(connection_timeout_sec); + stomp->options.connect_timeout_usec = STOMP_G(connection_timeout_usec); + +- stomp->status = stomp_connect(stomp, url_parts->host, url_parts->port ? url_parts->port : 61613 ); ++ stomp->status = stomp_connect(stomp, STOMP_URL_STR(url_parts->host), url_parts->port ? url_parts->port : 61613 ); + php_url_free(url_parts); + + if (stomp->status) { +@@ -908,7 +914,7 @@ PHP_FUNCTION(stomp_read_frame) + if (class_name && ZSTR_LEN(class_name)) { + ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO); + if (!ce) { +- php_error_docref(NULL , E_WARNING, "Could not find class '%s'", class_name); ++ php_error_docref(NULL , E_WARNING, "Could not find class '%s'", ZSTR_VAL(class_name)); + ce = stomp_ce_frame; + } + } else if (stomp_object) { +@@ -979,7 +985,9 @@ PHP_FUNCTION(stomp_read_frame) + fci.retval = &retval; + fci.no_separation = 1; + ++#if PHP_VERSION_ID < 70300 + fcc.initialized = 1; ++#endif + fcc.function_handler = ce->constructor; + #if (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0) + fcc.calling_scope = EG(scope); +diff --git a/stomp.c b/stomp.c +index be822e0..4831f2f 100644 +--- a/stomp.c ++++ b/stomp.c +@@ -209,7 +209,7 @@ int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_D + + stomp->fd = php_network_connect_socket_to_host(stomp->host, stomp->port, SOCK_STREAM, 0, &tv, NULL, NULL, NULL, 0, 0); + if (stomp->fd == -1) { +- snprintf(error, sizeof(error), "Unable to connect to %s:%ld", stomp->host, stomp->port); ++ snprintf(error, sizeof(error), "Unable to connect to %s:%d", stomp->host, stomp->port); + stomp_set_error(stomp, error, errno, "%s", strerror(errno)); + return 0; + } +@@ -257,7 +257,7 @@ int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_D + #endif + return 1; + } else { +- snprintf(error, sizeof(error), "Unable to connect to %s:%ld", stomp->host, stomp->port); ++ snprintf(error, sizeof(error), "Unable to connect to %s:%d", stomp->host, stomp->port); + stomp_set_error(stomp, error, errno, "%s", strerror(errno)); + return 0; + } diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..6171102 --- /dev/null +++ b/PHPINFO @@ -0,0 +1,15 @@ + +Stomp + +Stomp => enabled +API version => 2.0.1 +SSL Support => enabled + +Directive => Local Value => Master Value +stomp.default_broker => tcp://localhost:61613 => tcp://localhost:61613 +stomp.default_username => no value => no value +stomp.default_password => no value => no value +stomp.default_read_timeout_sec => 2 => 2 +stomp.default_read_timeout_usec => 0 => 0 +stomp.default_connection_timeout_sec => 2 => 2 +stomp.default_connection_timeout_usec => 0 => 0 diff --git a/REFLECTION b/REFLECTION index 4595d64..75ca409 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #132 Stomp version 2.0.1 ] { +Extension [ extension #146 Stomp version 2.0.1 ] { - INI { Entry [ stomp.default_broker ] diff --git a/php-pecl-stomp.spec b/php-pecl-stomp.spec index addcce4..c4ed221 100644 --- a/php-pecl-stomp.spec +++ b/php-pecl-stomp.spec @@ -1,6 +1,6 @@ # remimrepo/fedora spec file for php-pecl-stomp # -# Copyright (c) 2014-2017 Remi Collet +# Copyright (c) 2014-2018 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -16,12 +16,14 @@ Summary: Stomp client extension Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 2.0.1 -Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 4%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP -Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: https://github.com/php/pecl-tools-stomp/commit/9f0f5e450b0c27a565d9ffc5644be9cdc8345d71.patch + +BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pear BuildRequires: openssl-devel @@ -41,12 +43,6 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -Obsoletes: php53-pecl-%{pecl_name} <= %{version} -Obsoletes: php53u-pecl-%{pecl_name} <= %{version} -Obsoletes: php54-pecl-%{pecl_name} <= %{version} -Obsoletes: php54w-pecl-%{pecl_name} <= %{version} -Obsoletes: php55u-pecl-%{pecl_name} <= %{version} -Obsoletes: php55w-pecl-%{pecl_name} <= %{version} Obsoletes: php56u-pecl-%{pecl_name} <= %{version} Obsoletes: php56w-pecl-%{pecl_name} <= %{version} Obsoletes: php70u-pecl-%{pecl_name} <= %{version} @@ -88,6 +84,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .upstream # Sanity check, really often broken extver=$(sed -n '/#define PHP_STOMP_VERSION/{s/.* "//;s/".*$//;p}' php_stomp.h) @@ -120,6 +117,8 @@ EOF %build +%{?dtsenable} + peclbuild() { %configure \ --enable-stomp \ @@ -142,6 +141,8 @@ peclbuild %{_bindir}/zts-php-config %install +%{?dtsenable} + make -C NTS install INSTALL_ROOT=%{buildroot} # install config file @@ -162,7 +163,7 @@ do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done -%if 0%{?fedora} < 24 +%if 0%{?fedora} < 24 && 0%{?rhel} < 8 # when pear installed alone, after us %triggerin -- %{?scl_prefix}php-pear if [ -x %{__pecl} ] ; then @@ -213,6 +214,9 @@ fi %changelog +* Fri Jun 29 2018 Remi Collet - 2.0.1-4 +- add upstream patch for PHP 7.3 + * Tue Jul 18 2017 Remi Collet - 2.0.1-3 - rebuild for PHP 7.2.0beta1 new API -- cgit