From 0f37729be12ce3d1b82994e09b460ede17084354 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 13 Jul 2017 08:42:19 +0200 Subject: add patch for bad constants --- .gitignore | 7 +++++++ 73.patch | 31 +++++++++++++++++++++++++++++++ REFLECTION | 6 ++---- php-pecl-mosquitto.spec | 16 +++++++++++++++- 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 73.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/73.patch b/73.patch new file mode 100644 index 0000000..f7e9e42 --- /dev/null +++ b/73.patch @@ -0,0 +1,31 @@ +From a012b849d0a382c7f4ef3c1249f2ec6aec0ff7a9 Mon Sep 17 00:00:00 2001 +From: Tyson Andre +Date: Wed, 12 Jul 2017 08:45:54 -0700 +Subject: [PATCH] Stop creating inaccessible global constants "0" and "1" + +This was a side effect of the macro that was used to declare constants +for the values of the stringified version of the constant name. + +`get_defined_constants(true)['mosquitto']` can be used to show the old +constants (`["MOSQ_LOG_INFO"] => 1, ..., "0" => 0, "1" => 1]`) +--- + mosquitto.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/mosquitto.c b/mosquitto.c +index d1e105f..7341728 100644 +--- a/mosquitto.c ++++ b/mosquitto.c +@@ -1451,9 +1451,9 @@ PHP_MINIT_FUNCTION(mosquitto) + REGISTER_MOSQUITTO_LONG_CONST("LOG_WARNING", MOSQ_LOG_WARNING); + REGISTER_MOSQUITTO_LONG_CONST("LOG_ERR", MOSQ_LOG_ERR); + REGISTER_MOSQUITTO_LONG_CONST("LOG_DEBUG", MOSQ_LOG_DEBUG); +- +- REGISTER_MOSQUITTO_LONG_CONST("SSL_VERIFY_NONE", 0); +- REGISTER_MOSQUITTO_LONG_CONST("SSL_VERIFY_PEER", 1); ++ ++ zend_declare_class_constant_long(mosquitto_ce_client, "SSL_VERIFY_NONE", sizeof("SSL_VERIFY_NONE")-1, 0 TSRMLS_CC); ++ zend_declare_class_constant_long(mosquitto_ce_client, "SSL_VERIFY_PEER", sizeof("SSL_VERIFY_PEER")-1, 1 TSRMLS_CC); + + mosquitto_lib_init(); + diff --git a/REFLECTION b/REFLECTION index 295b568..65e2b27 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,13 +1,11 @@ -Extension [ extension #109 mosquitto version 0.4.0 ] { +Extension [ extension #110 mosquitto version 0.4.0 ] { - - Constants [7] { + - Constants [5] { Constant [ integer MOSQ_LOG_INFO ] { 1 } Constant [ integer MOSQ_LOG_NOTICE ] { 2 } Constant [ integer MOSQ_LOG_WARNING ] { 4 } Constant [ integer MOSQ_LOG_ERR ] { 8 } Constant [ integer MOSQ_LOG_DEBUG ] { 16 } - Constant [ integer 0 ] { 0 } - Constant [ integer 1 ] { 1 } } - Classes [3] { diff --git a/php-pecl-mosquitto.spec b/php-pecl-mosquitto.spec index edf123e..a966fb5 100644 --- a/php-pecl-mosquitto.spec +++ b/php-pecl-mosquitto.spec @@ -23,12 +23,16 @@ Summary: Extension for libmosquitto Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 0.4.0 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD Group: Development/Languages URL: http://pecl.php.net/package/%{proj_name} Source0: http://pecl.php.net/get/%{proj_name}-%{version}.tgz +# For https://github.com/etsy/phan/issues/1015 +# From https://github.com/mgdm/Mosquitto-PHP/pull/73 +Patch0: https://patch-diff.githubusercontent.com/raw/mgdm/Mosquitto-PHP/pull/73.patch + BuildRequires: %{?scl_prefix}php-devel > 5.3 BuildRequires: %{?scl_prefix}php-pear BuildRequires: mosquitto-devel @@ -68,6 +72,10 @@ Obsoletes: php70w-pecl-%{pecl_name} Obsoletes: php71u-pecl-%{pecl_name} Obsoletes: php71w-pecl-%{pecl_name} %endif +%if "%{php_version}" > "7.2" +Obsoletes: php72u-pecl-%{pecl_name} +Obsoletes: php72w-pecl-%{pecl_name} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -94,6 +102,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr73 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_MOSQUITTO_VERSION/{s/.* "//;s/".*$//;p}' php_mosquitto.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -209,6 +219,10 @@ cd ../ZTS %changelog +* Thu Jul 13 2017 Remi Collet - 0.4.0-2 +- add patch for https://github.com/etsy/phan/issues/1015 + from https://github.com/mgdm/Mosquitto-PHP/pull/73 + * Tue Mar 14 2017 Remi Collet - 0.4.0-1 - Update to 0.4.0 -- cgit