From 9f20f52ddd4188b2979429b2fb2fac35ba6beadd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 12 Oct 2018 14:26:55 +0200 Subject: add upstream patch for PHP 7.3 --- 0001-fix-Wimplicit-function-declaration.patch | 24 ++++++++++ ...-Fix-Wincompatible-pointer-types-with-7.3.patch | 28 ++++++++++++ ...ix-segfault-in-013.solrclient_getByIds.sh.patch | 53 ++++++++++++++++++++++ PHPINFO | 7 +++ php-pecl-solr2.spec | 30 +++++++----- 5 files changed, 131 insertions(+), 11 deletions(-) create mode 100644 0001-fix-Wimplicit-function-declaration.patch create mode 100644 0003-Fix-Wincompatible-pointer-types-with-7.3.patch create mode 100644 0005-fix-segfault-in-013.solrclient_getByIds.sh.patch create mode 100644 PHPINFO diff --git a/0001-fix-Wimplicit-function-declaration.patch b/0001-fix-Wimplicit-function-declaration.patch new file mode 100644 index 0000000..826862a --- /dev/null +++ b/0001-fix-Wimplicit-function-declaration.patch @@ -0,0 +1,24 @@ +From c07233b6975099d928ab487eb1dad929cca43531 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Oct 2018 13:49:25 +0200 +Subject: [PATCH 1/5] fix [-Wimplicit-function-declaration] + +--- + src/php7/php_solr.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/php7/php_solr.h b/src/php7/php_solr.h +index 0d32864..3704ec0 100644 +--- a/src/php7/php_solr.h ++++ b/src/php7/php_solr.h +@@ -642,6 +642,7 @@ PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_ent + PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC); + PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC); + PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC); ++PHP_SOLR_API void solr_input_document_register_class_constants(zend_class_entry *ce TSRMLS_DC); + + PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC); + PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...); +-- +2.14.4 + diff --git a/0003-Fix-Wincompatible-pointer-types-with-7.3.patch b/0003-Fix-Wincompatible-pointer-types-with-7.3.patch new file mode 100644 index 0000000..925b213 --- /dev/null +++ b/0003-Fix-Wincompatible-pointer-types-with-7.3.patch @@ -0,0 +1,28 @@ +From 9bdca9aaf4e6aa1ae61f43bb6be77f4540789374 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Oct 2018 13:55:42 +0200 +Subject: [PATCH 3/5] Fix [-Wincompatible-pointer-types] with 7.3 + +--- + src/php7/solr_functions_helpers.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/php7/solr_functions_helpers.c b/src/php7/solr_functions_helpers.c +index 2ac1fe0..eb32808 100644 +--- a/src/php7/solr_functions_helpers.c ++++ b/src/php7/solr_functions_helpers.c +@@ -1427,7 +1427,11 @@ static inline int solr_pcre_replace_into_buffer(solr_string_t *buffer, char * se + { + zend_string *result; + int limit = -1; ++#if PHP_VERSION_ID >= 70300 ++ size_t replace_count = -1; ++#else + int replace_count = -1; ++#endif + 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 +-- +2.14.4 + diff --git a/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch b/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch new file mode 100644 index 0000000..109b604 --- /dev/null +++ b/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch @@ -0,0 +1,53 @@ +From 9c0e23403876814f2812b4bad04989873194c91f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 12 Oct 2018 14:10:54 +0200 +Subject: [PATCH 5/5] fix segfault in 013.solrclient_getByIds.sh + +--- + src/php7/php_solr_client.c | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +diff --git a/src/php7/php_solr_client.c b/src/php7/php_solr_client.c +index 3c76f52..8bad5df 100644 +--- a/src/php7/php_solr_client.c ++++ b/src/php7/php_solr_client.c +@@ -1346,22 +1346,24 @@ PHP_METHOD(SolrClient, getByIds) + + solr_string_init(&query_string); + solr_string_appends(&query_string, "ids=", sizeof("ids=")-1); +- SOLR_HASHTABLE_FOR_LOOP(ids) +- { +- zval *id_zv = NULL; +- id_zv = zend_hash_get_current_data(ids); +- if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv)) { +- solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv)); +- solr_string_appendc(&query_string, ','); +- } else { +- invalid_param = 1; +- goto solr_getbyids_exit; ++ ++ if (ids->nNumOfElements) { ++ SOLR_HASHTABLE_FOR_LOOP(ids) ++ { ++ zval *id_zv = NULL; ++ id_zv = zend_hash_get_current_data(ids); ++ if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv)) { ++ solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv)); ++ solr_string_appendc(&query_string, ','); ++ } else { ++ invalid_param = 1; ++ goto solr_getbyids_exit; ++ } ++ current_position++; + } +- current_position++; + } + + +- + solr_getbyids_exit: + if (invalid_param) { + solr_string_free(&query_string); +-- +2.14.4 + diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..6312613 --- /dev/null +++ b/PHPINFO @@ -0,0 +1,7 @@ + +solr + +Solr Support => enabled +Version => 2.4.0 +Last Build Date => Aug 8 2017 +Last Build Time => 08:35:58 diff --git a/php-pecl-solr2.spec b/php-pecl-solr2.spec index 5bdf488..381c5c6 100644 --- a/php-pecl-solr2.spec +++ b/php-pecl-solr2.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-solr2 # -# Copyright (c) 2011-2017 Remi Collet +# Copyright (c) 2011-2018 Remi Collet # Copyright (c) 2010 Johan Cwiklinski # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ @@ -35,7 +35,7 @@ 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: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 11%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/solr @@ -43,6 +43,9 @@ URL: http://pecl.php.net/package/solr Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz Patch0: upstream.patch +Patch1: 0001-fix-Wimplicit-function-declaration.patch +Patch2: 0003-Fix-Wincompatible-pointer-types-with-7.3.patch +Patch3: 0005-fix-segfault-in-013.solrclient_getByIds.sh.patch BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear @@ -79,14 +82,6 @@ Conflicts: %{?scl_prefix}php-pecl-%{pecl_name} < 2 %endif %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -Obsoletes: php53-pecl-%{pecl_name}2 <= %{version} -Obsoletes: php53u-pecl-%{pecl_name}2 <= %{version} -Obsoletes: php54-pecl-%{pecl_name}2 <= %{version} -Obsoletes: php54w-pecl-%{pecl_name}2 <= %{version} -%if "%{php_version}" > "5.5" -Obsoletes: php55u-pecl-%{pecl_name}2 <= %{version} -Obsoletes: php55w-pecl-%{pecl_name}2 <= %{version} -%endif %if "%{php_version}" > "5.6" Obsoletes: php56u-pecl-%{pecl_name}2 <= %{version} Obsoletes: php56w-pecl-%{pecl_name}2 <= %{version} @@ -109,6 +104,12 @@ Obsoletes: php72w-pecl-%{pecl_name} <= %{version} Obsoletes: php72u-pecl-%{pecl_name}2 <= %{version} Obsoletes: php72w-pecl-%{pecl_name}2 <= %{version} %endif +%if "%{php_version}" > "7.3" +Obsoletes: php73u-pecl-%{pecl_name} <= %{version} +Obsoletes: php73w-pecl-%{pecl_name} <= %{version} +Obsoletes: php73u-pecl-%{pecl_name}2 <= %{version} +Obsoletes: php73w-pecl-%{pecl_name}2 <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -156,6 +157,10 @@ mv %{pecl_name}-%{version}%{?prever} NTS cd NTS %patch0 -p1 -b .upstream +%patch1 -p1 -b .up1 +%patch2 -p1 -b .up2 +%patch3 -p1 -b .up3 + # 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) @@ -246,7 +251,7 @@ fi %if %{with_tests} sed -e '/SOLR_SERVER_CONFIGURED/s/false/true/' \ - -e '/SOLR_SERVER_HOSTNAME/s/solr5/localhost/' \ + -e '/SOLR_SERVER_HOSTNAME/s/solr.test/localhost/' \ -i ?TS/tests/test.config.inc %else sed -e '/SOLR_SERVER_CONFIGURED/s/true/false/' \ @@ -303,6 +308,9 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \ %changelog +* Fri Oct 12 2018 Remi Collet - 2.4.0-11 +- add upstream patch for PHP 7.3 + * Tue Jul 18 2017 Remi Collet - 2.4.0-5 - rebuild for PHP 7.2.0beta1 new API -- cgit