Skip to content

Commit

Permalink
Fix for 7.2:
Browse files Browse the repository at this point in the history
- ZEND_ACC_CLONE have been removed, and was not used in previous versions
- fix php_pcre_replace call
  • Loading branch information
remicollet committed Jun 23, 2017
1 parent 2ee19ba commit 744e329
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/php7/php_solr.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 14 additions & 1 deletion src/php7/solr_functions_helpers.c
Expand Up @@ -1404,27 +1404,40 @@ 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
);

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);

Expand Down

3 comments on commit 744e329

@glensc
Copy link
Contributor

@glensc glensc commented on 744e329 Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@remicollet can you push this to be released on pecl?

can't compile for php 7.2

https://bugs.php.net/bug.php?id=75631

@remicollet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glensc sorry, but I don't have this power (only contributor, not lead)

@libotsUGA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@remicollet En tout cas, un grand merci à vous pour avoir corrigé le souci !

Please sign in to comment.