summaryrefslogtreecommitdiffstats
path: root/solr-php82.patch
blob: 67c89da5bc0af8a585479620a75e94449dff7465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From e90b33b4c5d3b94da4f12923242f943aa5558d4c Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 9 Sep 2022 15:37:33 +0200
Subject: [PATCH 1/2] fix __toString method for 8.2

---
 src/php7/php_solr.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/php7/php_solr.c b/src/php7/php_solr.c
index de69bc8..d06a9cc 100644
--- a/src/php7/php_solr.c
+++ b/src/php7/php_solr.c
@@ -554,6 +554,13 @@ ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, mime_type)
 ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, params, SolrModifiableParams, SOLR_ARG_ALLOW_NULL_FALSE)
 ZEND_END_ARG_INFO()
 
+#if PHP_VERSION_ID >= 80200
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(Solr_toString_args, 0, 0, IS_STRING, 0)
+#else
+ZEND_BEGIN_ARG_INFO_EX(Solr_toString_args, 0, 0, 0)
+#endif
+ZEND_END_ARG_INFO();
+
 
 /* }}} */
 
@@ -619,7 +626,7 @@ static zend_function_entry solr_collapse_function_methods[] = {
 
     PHP_ME(SolrCollapseFunction, setNullPolicy, SolrCollapseFunction_set_null_policy_args, ZEND_ACC_PUBLIC)
     PHP_ME(SolrCollapseFunction, getNullPolicy, Solr_no_args, ZEND_ACC_PUBLIC)
-    PHP_ME(SolrCollapseFunction, __toString, Solr_no_args, ZEND_ACC_PUBLIC)
+    PHP_ME(SolrCollapseFunction, __toString, Solr_toString_args, ZEND_ACC_PUBLIC)
     PHP_ME(SolrCollapseFunction, __sleep, Solr_no_args, ZEND_ACC_PUBLIC)
     PHP_ME(SolrCollapseFunction, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC)
 
@@ -788,7 +795,7 @@ static zend_function_entry solr_illegal_argument_exception_methods[] = {
 static zend_function_entry solr_params_methods[] = {
 	PHP_ME(SolrParams, setParam,  SolrParams_setParam_args, ZEND_ACC_PUBLIC)
 	PHP_ME(SolrParams, addParam,  SolrParams_addParam_args, ZEND_ACC_PUBLIC)
-	PHP_ME(SolrParams, __toString, Solr_no_args, ZEND_ACC_PUBLIC)
+	PHP_ME(SolrParams, __toString, Solr_toString_args, ZEND_ACC_PUBLIC)
 	PHP_ME(SolrParams, toString, SolrParams_toString_args, ZEND_ACC_PUBLIC)
 	PHP_ME(SolrParams, getParams, Solr_no_args, ZEND_ACC_PUBLIC)
 	PHP_ME(SolrParams, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC)

From 0c0e3d155f58a674e654e2aa447d9f8570ac4fc8 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 9 Nov 2022 13:32:41 +0100
Subject: [PATCH 2/2] allow dynamic properties

---
 src/php7/php_solr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/php7/php_solr.c b/src/php7/php_solr.c
index d06a9cc..8062090 100644
--- a/src/php7/php_solr.c
+++ b/src/php7/php_solr.c
@@ -1207,6 +1207,9 @@ PHP_MINIT_FUNCTION(solr)
     INIT_CLASS_ENTRY(ce, PHP_SOLR_OBJECT_CLASSNAME, solr_object_methods);
     solr_ce_SolrObject = zend_register_internal_class(&ce);
     solr_ce_SolrObject->ce_flags |= ZEND_ACC_FINAL;
+#if PHP_VERSION_ID >= 80200
+    solr_ce_SolrObject->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
+#endif
 
     /* SolrObject implements ArrayAccess */
     zend_class_implements(solr_ce_SolrObject, 1, solr_ce_ArrayAccess);
@@ -1239,6 +1242,9 @@ PHP_MINIT_FUNCTION(solr)
     INIT_CLASS_ENTRY(ce, PHP_SOLR_INPUT_DOCUMENT_CLASSNAME, solr_input_document_methods);
     solr_ce_SolrInputDocument = zend_register_internal_class(&ce);
     solr_ce_SolrInputDocument->ce_flags |= ZEND_ACC_FINAL;
+#if PHP_VERSION_ID >= 80200
+    solr_ce_SolrInputDocument->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES;
+#endif
 
     /* This internal property will be used to map to this SolrDocument instance */
     zend_declare_property_long(solr_ce_SolrInputDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE);