From ac1b5c26136dac3f0ce81d3e4ee229340b32fe95 Mon Sep 17 00:00:00 2001 From: Remi Collet 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 +}