summaryrefslogtreecommitdiffstats
path: root/276.patch
blob: 4eb0c88b3162b0c355c6d0916f0c79ba469bc879 (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
From ac1b5c26136dac3f0ce81d3e4ee229340b32fe95 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 15 Oct 2020 12:01:37 +0200
Subject: [PATCH] fix build with PHP 8.0.0RC2

---
 src/sky_predis.cc | 9 ++++++++-
 src/sky_utils.cc  | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/sky_predis.cc b/src/sky_predis.cc
index 0e93241..eb3ddd2 100644
--- a/src/sky_predis.cc
+++ b/src/sky_predis.cc
@@ -32,9 +32,16 @@ Span *sky_predis(zend_execute_data *execute_data, char *class_name, char *functi
 
         zval *id = (zval *) emalloc(sizeof(zval));
         zval *arguments = (zval *) emalloc(sizeof(zval));
+#if PHP_VERSION_ID < 80000
         zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr, nullptr);
         zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments, 0, nullptr,
                          nullptr);
+#else
+        zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr,
+                         nullptr);
+        zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments,
+                         0, nullptr, nullptr);
+#endif
 
         if (id != nullptr && Z_TYPE_P(id) == IS_STRING) {
             span->setOperationName(_class_name + "->" + std::string(Z_STRVAL_P(id)));
@@ -118,4 +125,4 @@ static std::string sky_predis_command(zval *id, zval *arguments) {
     }
 
     return nullptr;
-}
\ No newline at end of file
+}
diff --git a/src/sky_utils.cc b/src/sky_utils.cc
index 61c5089..d9053e4 100644
--- a/src/sky_utils.cc
+++ b/src/sky_utils.cc
@@ -86,7 +86,11 @@ zval *sky_read_property(zval *obj, const char *property, int parent) {
             ce = object->ce->parent;
         }
 
+#if PHP_VERSION_ID < 80000
         return zend_read_property(ce, obj, property, strlen(property), 0, nullptr);
+#else
+        return zend_read_property(ce, object, property, strlen(property), 0, nullptr);
+#endif
     }
     return nullptr;
 }
@@ -97,4 +101,4 @@ std::string sky_get_class_name(zval *obj) {
         return ZSTR_VAL(object->ce->name);
     }
     return "";
-}
\ No newline at end of file
+}