php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #77625
Patch dynamiclogisticset.com revision 2019-02-27 12:33 UTC by dynamicbuzg at gmail dot com
Patch fix_for_php7.2 revision 2019-02-15 16:32 UTC by tuanbk08vn at gmail dot com

Patch fix_for_php7.2 for solr Bug #77625

Patch version 2019-02-15 16:32 UTC

Return to Bug #77625 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: tuanbk08vn@gmail.com

diff -ru php-7.2.14.orig/ext/solr/src/php7/php_solr.c php-7.2.14/ext/solr/src/php7/php_solr.c
--- php-7.2.14.orig/ext/solr/src/php7/php_solr.c	2016-03-30 20:42:31.000000000 +0700
+++ php-7.2.14/ext/solr/src/php7/php_solr.c	2019-01-13 10:48:58.000000000 +0700
@@ -557,7 +557,7 @@
 	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)
@@ -600,7 +600,7 @@
 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)
@@ -633,7 +633,7 @@
 	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)
@@ -710,7 +710,7 @@
 	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 -ru php-7.2.14.orig/ext/solr/src/php7/solr_functions_helpers.c php-7.2.14/ext/solr/src/php7/solr_functions_helpers.c
--- php-7.2.14.orig/ext/solr/src/php7/solr_functions_helpers.c	2016-03-30 20:42:31.000000000 +0700
+++ php-7.2.14/ext/solr/src/php7/solr_functions_helpers.c	2019-01-13 11:40:54.000000000 +0700
@@ -1389,19 +1389,28 @@
 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
     );
@@ -1409,7 +1418,11 @@
     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);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC