From 7619dfe9855d3f7dcb27ca21148eace2c36d4868 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 23 Jun 2017 16:32:51 +0200 Subject: upstream patch for 7.2 --- .gitignore | 7 ++++ php-pecl-solr2.spec | 23 ++++++------ upstream.patch | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100644 upstream.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/php-pecl-solr2.spec b/php-pecl-solr2.spec index b1e7cc4..3f58361 100644 --- a/php-pecl-solr2.spec +++ b/php-pecl-solr2.spec @@ -35,14 +35,15 @@ Summary: Object oriented API to Apache Solr Summary(fr): API orientée objet pour Apache Solr Name: %{?sub_prefix}php-pecl-solr2 Version: 2.4.0 -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;')}} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/solr Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: upstream.patch + BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-curl @@ -102,6 +103,12 @@ Obsoletes: php71w-pecl-%{pecl_name} <= %{version} Obsoletes: php71u-pecl-%{pecl_name}2 <= %{version} Obsoletes: php71w-pecl-%{pecl_name}2 <= %{version} %endif +%if "%{php_version}" > "7.2" +Obsoletes: php72u-pecl-%{pecl_name} <= %{version} +Obsoletes: php72w-pecl-%{pecl_name} <= %{version} +Obsoletes: php72u-pecl-%{pecl_name}2 <= %{version} +Obsoletes: php72w-pecl-%{pecl_name}2 <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -148,7 +155,7 @@ sed -e 's/role="test"/role="src"/' \ mv %{pecl_name}-%{version}%{?prever} NTS cd NTS - +%patch0 -p1 -b .upstream # Check version DIR=src/php$(%{__php} -r 'echo PHP_MAJOR_VERSION;') extver=$(sed -n '/#define PHP_SOLR_VERSION /{s/.* "//;s/".*$//;p}' $DIR/php_solr_version.h) @@ -185,8 +192,6 @@ make %{?_smp_mflags} %install -rm -rf %{buildroot} - make -C NTS install INSTALL_ROOT=%{buildroot} # Install XML package description @@ -283,12 +288,7 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \ %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-, root, root, -) %{?_licensedir:%license NTS/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -303,6 +303,9 @@ rm -rf %{buildroot} %changelog +* Fri Jun 23 2017 Remi Collet - 2.4.0-4 +- add upstream patch for PHP 7.2 + * Thu Dec 1 2016 Remi Collet - 2.4.0-3 - rebuild with PHP 7.1.0 GA diff --git a/upstream.patch b/upstream.patch new file mode 100644 index 0000000..de020f2 --- /dev/null +++ b/upstream.patch @@ -0,0 +1,100 @@ +From 744e32915d5989101267ed2c84a407c582dc6f31 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 23 Jun 2017 16:25:50 +0200 +Subject: [PATCH] Fix for 7.2: - ZEND_ACC_CLONE have been removed, and was not + used in previous versions - fix php_pcre_replace call + +--- + src/php7/php_solr.c | 8 ++++---- + src/php7/solr_functions_helpers.c | 15 ++++++++++++++- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/src/php7/php_solr.c b/src/php7/php_solr.c +index 568b7c5..297f444 100644 +--- a/src/php7/php_solr.c ++++ b/src/php7/php_solr.c +@@ -566,7 +566,7 @@ static zend_function_entry solr_document_methods[] = { + SOLR_CTOR(SolrDocument, __construct, SolrDocument__construct_args) + SOLR_DTOR(SolrDocument, __destruct, Solr_no_args) + +- PHP_ME(SolrDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) ++ PHP_ME(SolrDocument, __clone, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrDocument, __set, SolrDocument_addField_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrDocument, __get, SolrDocument_getField_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrDocument, __isset, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) +@@ -609,7 +609,7 @@ static zend_function_entry solr_document_methods[] = { + static zend_function_entry solr_input_document_methods[] = { + SOLR_CTOR(SolrInputDocument, __construct, SolrInputDocument__construct_args) + SOLR_DTOR(SolrInputDocument, __destruct, Solr_no_args) +- PHP_ME(SolrInputDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) ++ PHP_ME(SolrInputDocument, __clone, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrInputDocument, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrInputDocument, __wakeup, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrInputDocument, setBoost, SolrInputDocument_setBoost_args, ZEND_ACC_PUBLIC) +@@ -645,7 +645,7 @@ static zend_function_entry solr_client_methods[] = { + SOLR_DTOR(SolrClient, __destruct, Solr_no_args) + PHP_ME(SolrClient, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrClient, __wakeup, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(SolrClient, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) ++ PHP_ME(SolrClient, __clone, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrClient, getOptions, Solr_no_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrClient, getDebug, Solr_no_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrClient, setServlet, SolrClient_setServlet_args, ZEND_ACC_PUBLIC) +@@ -722,7 +722,7 @@ static zend_function_entry solr_params_methods[] = { + PHP_ME(SolrParams, getParams, Solr_no_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrParams, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) + PHP_ME(SolrParams, getPreparedParams, Solr_no_args, ZEND_ACC_PUBLIC) +- PHP_ME(SolrParams, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) ++ PHP_ME(SolrParams, __clone, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrParams, serialize, NULL, ZEND_ACC_PUBLIC) + PHP_ME(SolrParams, unserialize, SolrParams_unserialize_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(SolrParams, add, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) +diff --git a/src/php7/solr_functions_helpers.c b/src/php7/solr_functions_helpers.c +index b249a99..6d24ff4 100644 +--- a/src/php7/solr_functions_helpers.c ++++ b/src/php7/solr_functions_helpers.c +@@ -1404,19 +1404,28 @@ PHP_SOLR_API long solr_get_json_last_error(TSRMLS_D) + static inline int solr_pcre_replace_into_buffer(solr_string_t *buffer, char * search, char *replace) + { + zend_string *result; +- zval replace_val; + int limit = -1; + int replace_count = -1; + zend_string *regex_str = zend_string_init(search, strlen(search), 0); + zend_string *subject_str = zend_string_init(buffer->str, buffer->len, 0); ++#if PHP_VERSION_ID >= 70200 ++ zend_string *replace_str = zend_string_init(replace, strlen(replace), 0); ++#else ++ zval replace_val; + ZVAL_STRING(&replace_val, replace); ++#endif ++ + result = php_pcre_replace( + regex_str, + subject_str, + buffer->str, + buffer->len, ++#if PHP_VERSION_ID >= 70200 ++ replace_str, ++#else + &replace_val, + 0, ++#endif + limit, + &replace_count + ); +@@ -1424,7 +1433,11 @@ static inline int solr_pcre_replace_into_buffer(solr_string_t *buffer, char * se + solr_string_set_ex(buffer, (solr_char_t *)result->val, (size_t)result->len); + /* fprintf(stdout, "%s", buffer->str); */ + efree(result); ++#if PHP_VERSION_ID >= 70200 ++ zend_string_release(replace_str); ++#else + zval_ptr_dtor(&replace_val); ++#endif + zend_string_release(regex_str); + zend_string_release(subject_str); + +-- +2.1.4 + -- cgit