summaryrefslogtreecommitdiffstats
path: root/cassandra-php8.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-06-15 11:39:30 +0200
committerRemi Collet <remi@php.net>2022-06-15 11:39:30 +0200
commit9db3d9d8ecc38f2d547434f1edd213dd202abe30 (patch)
treef490657b2634114ae6bab814c2b2de139f694855 /cassandra-php8.patch
parent68a7ed1e4fbc8d148295fc42a61624a69afc44bd (diff)
add patch for PHP 8 from extension fork
https://github.com/nano-interactive/cassandra-php-driver/ add patch for PHP 8.1 from https://github.com/nano-interactive/cassandra-php-driver/pull/29
Diffstat (limited to 'cassandra-php8.patch')
-rw-r--r--cassandra-php8.patch6473
1 files changed, 6473 insertions, 0 deletions
diff --git a/cassandra-php8.patch b/cassandra-php8.patch
new file mode 100644
index 0000000..d44d4ca
--- /dev/null
+++ b/cassandra-php8.patch
@@ -0,0 +1,6473 @@
+From 4da3b2368daccd19b9d51d5c971233bf9e0149aa Mon Sep 17 00:00:00 2001
+From: Marko Dobromirovic <codespill.github@gmail.com>
+Date: Fri, 25 Dec 2020 18:19:20 +0100
+Subject: [PATCH] PHP 8 Compatibility with PreparedStatements
+
+---
+ ext/php_driver.c | 10 +++-
+ ext/php_driver.h | 10 ++++
+ ext/php_driver_globals.h | 2 +
+ ext/php_driver_types.h | 10 ++++
+ ext/src/BatchStatement.c | 17 +++++-
+ ext/src/Bigint.c | 44 ++++++++++++---
+ ext/src/Blob.c | 32 +++++++++--
+ ext/src/Cluster/Builder.c | 33 ++++++++++--
+ ext/src/Collection.c | 32 +++++++++--
+ ext/src/Date.c | 36 +++++++++++--
+ ext/src/Decimal.c | 48 +++++++++++++++--
+ ext/src/DefaultAggregate.c | 24 ++++++++-
+ ext/src/DefaultCluster.c | 24 +++++++--
+ ext/src/DefaultColumn.c | 24 ++++++++-
+ ext/src/DefaultFunction.c | 24 ++++++++-
+ ext/src/DefaultIndex.c | 20 ++++++-
+ ext/src/DefaultKeyspace.c | 20 ++++++-
+ ext/src/DefaultMaterializedView.c | 20 ++++++-
+ ext/src/DefaultSchema.c | 12 ++++-
+ ext/src/DefaultSession.c | 89 +++++++++++++++++++++++++++----
+ ext/src/DefaultTable.c | 22 ++++++--
+ ext/src/Duration.c | 20 ++++++-
+ ext/src/ExecutionOptions.c | 12 ++++-
+ ext/src/Float.c | 44 +++++++++++++--
+ ext/src/FutureClose.c | 12 ++++-
+ ext/src/FuturePreparedStatement.c | 12 ++++-
+ ext/src/FutureRows.c | 12 ++++-
+ ext/src/FutureSession.c | 12 ++++-
+ ext/src/FutureValue.c | 12 ++++-
+ ext/src/Inet.c | 28 ++++++++--
+ ext/src/Map.c | 28 ++++++++--
+ ext/src/PreparedStatement.c | 17 +++++-
+ ext/src/Rows.c | 12 ++++-
+ ext/src/SSLOptions.c | 12 ++++-
+ ext/src/SSLOptions/Builder.c | 12 ++++-
+ ext/src/Set.c | 28 ++++++++--
+ ext/src/SimpleStatement.c | 12 ++++-
+ ext/src/Smallint.c | 44 +++++++++++++--
+ ext/src/Time.c | 32 +++++++++--
+ ext/src/Timestamp.c | 34 +++++++++---
+ ext/src/Timeuuid.c | 28 ++++++++--
+ ext/src/Tinyint.c | 44 +++++++++++++--
+ ext/src/Tuple.c | 28 ++++++++--
+ ext/src/Type/Collection.c | 28 ++++++++--
+ ext/src/Type/Custom.c | 28 ++++++++--
+ ext/src/Type/Map.c | 28 ++++++++--
+ ext/src/Type/Scalar.c | 28 ++++++++--
+ ext/src/Type/Set.c | 28 ++++++++--
+ ext/src/Type/Tuple.c | 28 ++++++++--
+ ext/src/Type/UserType.c | 28 ++++++++--
+ ext/src/UserTypeValue.c | 42 ++++++++++-----
+ ext/src/Uuid.c | 28 ++++++++--
+ ext/src/Varint.c | 44 +++++++++++++--
+ ext/util/hash.c | 12 ++++-
+ 54 files changed, 1218 insertions(+), 152 deletions(-)
+
+diff --git a/ext/php_driver.c b/ext/php_driver.c
+index 14b7a31d..ba0cb2c2 100644
+--- a/ext/php_driver.c
++++ b/ext/php_driver.c
+@@ -598,19 +598,25 @@ PHP_MINFO_FUNCTION(php_driver)
+ {
+ char buf[256];
+ php_info_print_table_start();
+- php_info_print_table_header(2, PHP_DRIVER_NAMESPACE " support", "enabled");
++
++ php_info_print_table_row(2, PHP_DRIVER_NAMESPACE " support", "enabled");
+
+ snprintf(buf, sizeof(buf), "%d.%d.%d%s",
+ CASS_VERSION_MAJOR, CASS_VERSION_MINOR, CASS_VERSION_PATCH,
+- strlen(CASS_VERSION_SUFFIX) > 0 ? "-" CASS_VERSION_SUFFIX : "");
++ (strlen(CASS_VERSION_SUFFIX) > 0 ? "-" CASS_VERSION_SUFFIX : ""));
+ php_info_print_table_row(2, "C/C++ driver version", buf);
+
++ php_info_print_table_row(2, "PHP driver extension", "customized for persistent prepared statements");
++
+ snprintf(buf, sizeof(buf), "%d", PHP_DRIVER_G(persistent_clusters));
+ php_info_print_table_row(2, "Persistent Clusters", buf);
+
+ snprintf(buf, sizeof(buf), "%d", PHP_DRIVER_G(persistent_sessions));
+ php_info_print_table_row(2, "Persistent Sessions", buf);
+
++ snprintf(buf, sizeof(buf), "%d", PHP_DRIVER_G(persistent_prepared_statements));
++ php_info_print_table_row(2, "Persistent Prepared Statements", buf);
++
+ php_info_print_table_end();
+
+ DISPLAY_INI_ENTRIES();
+diff --git a/ext/php_driver.h b/ext/php_driver.h
+index 3ed2ad15..6fbc79bb 100644
+--- a/ext/php_driver.h
++++ b/ext/php_driver.h
+@@ -46,6 +46,16 @@ typedef int pid_t;
+ # error PHP 5.6.0 or later is required in order to build the driver
+ #endif
+
++#if PHP_VERSION_ID >= 80000
++ #ifndef TSRMLS_D
++ #define TSRMLS_D void
++ #define TSRMLS_DC
++ #define TSRMLS_C
++ #define TSRMLS_CC
++ #define TSRMLS_FETCH()
++ #endif
++#endif
++
+ #include <ext/spl/spl_iterators.h>
+ #include <ext/spl/spl_exceptions.h>
+
+diff --git a/ext/php_driver_globals.h b/ext/php_driver_globals.h
+index dff58c3a..04bd9525 100644
+--- a/ext/php_driver_globals.h
++++ b/ext/php_driver_globals.h
+@@ -6,6 +6,7 @@ ZEND_BEGIN_MODULE_GLOBALS(php_driver)
+ pid_t uuid_gen_pid;
+ unsigned int persistent_clusters;
+ unsigned int persistent_sessions;
++ unsigned int persistent_prepared_statements;
+ php5to7_zval type_varchar;
+ php5to7_zval type_text;
+ php5to7_zval type_blob;
+@@ -27,6 +28,7 @@ ZEND_BEGIN_MODULE_GLOBALS(php_driver)
+ php5to7_zval type_smallint;
+ php5to7_zval type_tinyint;
+ php5to7_zval type_duration;
++ zend_resource stmt;
+ ZEND_END_MODULE_GLOBALS(php_driver)
+
+ ZEND_EXTERN_MODULE_GLOBALS(php_driver)
+diff --git a/ext/php_driver_types.h b/ext/php_driver_types.h
+index cc7b751e..d6d25573 100644
+--- a/ext/php_driver_types.h
++++ b/ext/php_driver_types.h
+@@ -367,6 +367,8 @@ PHP_DRIVER_BEGIN_OBJECT_TYPE(future_session)
+ int hash_key_len;
+ char *exception_message;
+ CassError exception_code;
++ char* session_keyspace;
++ char* session_hash_key;
+ PHP_DRIVER_END_OBJECT_TYPE(future_session)
+
+ typedef struct {
+@@ -374,10 +376,17 @@ typedef struct {
+ php_driver_ref *session;
+ } php_driver_psession;
+
++typedef struct {
++ CassFuture *future;
++ php_driver_ref *ref;
++} php_driver_pprepared_statement;
++
+ PHP_DRIVER_BEGIN_OBJECT_TYPE(session)
+ php_driver_ref *session;
+ long default_consistency;
+ int default_page_size;
++ char* keyspace;
++ char* hash_key;
+ php5to7_zval default_timeout;
+ cass_bool_t persist;
+ PHP_DRIVER_END_OBJECT_TYPE(session)
+@@ -734,5 +743,6 @@ void php_driver_define_TimestampGeneratorServerSide(TSRMLS_D);
+
+ extern int php_le_php_driver_cluster();
+ extern int php_le_php_driver_session();
++extern int php_le_php_driver_prepared_statement();
+
+ #endif /* PHP_DRIVER_TYPES_H */
+diff --git a/ext/src/BatchStatement.c b/ext/src/BatchStatement.c
+index 1a445490..84e515ef 100644
+--- a/ext/src/BatchStatement.c
++++ b/ext/src/BatchStatement.c
+@@ -122,8 +122,15 @@ static zend_function_entry php_driver_batch_statement_methods[] = {
+
+ static zend_object_handlers php_driver_batch_statement_handlers;
+
++
+ static HashTable *
+-php_driver_batch_statement_properties(zval *object TSRMLS_DC)
++php_driver_batch_statement_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object TSRMLS_DC
++#else
++ zval *object TSRMLS_DC
++#endif
++ )
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -175,6 +182,14 @@ void php_driver_define_BatchStatement(TSRMLS_D)
+
+ memcpy(&php_driver_batch_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_batch_statement_handlers.get_properties = php_driver_batch_statement_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_batch_statement_handlers.compare = php_driver_batch_statement_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_batch_statement_handlers.compare = php_driver_batch_statement_compare;
++#else
+ php_driver_batch_statement_handlers.compare_objects = php_driver_batch_statement_compare;
++#endif
++#endif
+ php_driver_batch_statement_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Bigint.c b/ext/src/Bigint.c
+index bb542cd5..e412f23c 100644
+--- a/ext/src/Bigint.c
++++ b/ext/src/Bigint.c
+@@ -394,7 +394,13 @@ static zend_function_entry php_driver_bigint_methods[] = {
+ static php_driver_value_handlers php_driver_bigint_handlers;
+
+ static HashTable *
+-php_driver_bigint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_bigint_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -402,12 +408,24 @@ php_driver_bigint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_bigint_properties(zval *object TSRMLS_DC)
++php_driver_bigint_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object TSRMLS_DC
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_BIGINT TSRMLS_CC);
+@@ -448,9 +466,21 @@ php_driver_bigint_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_bigint_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_bigint_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -501,8 +531,8 @@ void php_driver_define_Bigint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_bigint_handlers.std.get_gc = php_driver_bigint_gc;
+ #endif
+- php_driver_bigint_handlers.std.compare_objects = php_driver_bigint_compare;
+- php_driver_bigint_handlers.std.cast_object = php_driver_bigint_cast;
++ php_driver_bigint_handlers.std.compare = php_driver_bigint_compare;
++ php_driver_bigint_handlers.std.cast_object = php_driver_bigint_cast;
+
+ php_driver_bigint_handlers.hash_value = php_driver_bigint_hash_value;
+ php_driver_bigint_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/Blob.c b/ext/src/Blob.c
+index 17a24300..3592e064 100644
+--- a/ext/src/Blob.c
++++ b/ext/src/Blob.c
+@@ -113,7 +113,13 @@ static zend_function_entry php_driver_blob_methods[] = {
+ static php_driver_value_handlers php_driver_blob_handlers;
+
+ static HashTable *
+-php_driver_blob_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_blob_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -121,14 +127,26 @@ php_driver_blob_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_blob_properties(zval *object TSRMLS_DC)
++php_driver_blob_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object TSRMLS_DC
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ char *hex;
+ int hex_len;
+ php5to7_zval type;
+ php5to7_zval bytes;
+
+- php_driver_blob *self = PHP_DRIVER_GET_BLOB(object);
++ php_driver_blob *self = PHP_DRIVER_GET_BLOB(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_BLOB TSRMLS_CC);
+@@ -205,7 +223,15 @@ void php_driver_define_Blob(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_blob_handlers.std.get_gc = php_driver_blob_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_blob_handlers.std.compare = php_driver_blob_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_blob_handlers.std.compare = php_driver_blob_compare;
++#else
+ php_driver_blob_handlers.std.compare_objects = php_driver_blob_compare;
++#endif
++#endif
+ php_driver_blob_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_blob_ce->create_object = php_driver_blob_new;
+
+diff --git a/ext/src/Cluster/Builder.c b/ext/src/Cluster/Builder.c
+index 97ca0d87..64ce56a5 100644
+--- a/ext/src/Cluster/Builder.c
++++ b/ext/src/Cluster/Builder.c
+@@ -1063,7 +1063,14 @@ static zend_function_entry php_driver_cluster_builder_methods[] = {
+ static zend_object_handlers php_driver_cluster_builder_handlers;
+
+ static HashTable*
+-php_driver_cluster_builder_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_cluster_builder_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -1071,7 +1078,13 @@ php_driver_cluster_builder_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS
+ }
+
+ static HashTable*
+-php_driver_cluster_builder_properties(zval *object TSRMLS_DC)
++php_driver_cluster_builder_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object TSRMLS_DC
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval contactPoints;
+ php5to7_zval loadBalancingPolicy;
+@@ -1107,7 +1120,13 @@ php_driver_cluster_builder_properties(zval *object TSRMLS_DC)
+ php5to7_zval randomizedContactPoints;
+ php5to7_zval connectionHeartbeatInterval;
+
+- php_driver_cluster_builder *self = PHP_DRIVER_GET_CLUSTER_BUILDER(object);
++ php_driver_cluster_builder *self = PHP_DRIVER_GET_CLUSTER_BUILDER(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(contactPoints);
+@@ -1442,5 +1461,13 @@ void php_driver_define_ClusterBuilder(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_cluster_builder_handlers.get_gc = php_driver_cluster_builder_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_cluster_builder_handlers.compare = php_driver_cluster_builder_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_cluster_builder_handlers.compare = php_driver_cluster_builder_compare;
++#else
+ php_driver_cluster_builder_handlers.compare_objects = php_driver_cluster_builder_compare;
++#endif
++#endif
+ }
+diff --git a/ext/src/Collection.c b/ext/src/Collection.c
+index ceebfee1..8b595b8e 100644
+--- a/ext/src/Collection.c
++++ b/ext/src/Collection.c
+@@ -312,7 +312,13 @@ static zend_function_entry php_driver_collection_methods[] = {
+ static php_driver_value_handlers php_driver_collection_handlers;
+
+ static HashTable *
+-php_driver_collection_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_collection_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -320,11 +326,23 @@ php_driver_collection_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_collection_properties(zval *object TSRMLS_DC)
++php_driver_collection_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval values;
+
+- php_driver_collection *self = PHP_DRIVER_GET_COLLECTION(object);
++ php_driver_collection *self = PHP_DRIVER_GET_COLLECTION(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -442,7 +460,15 @@ void php_driver_define_Collection(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_collection_handlers.std.get_gc = php_driver_collection_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_collection_handlers.std.compare = php_driver_collection_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_collection_handlers.std.compare = php_driver_collection_compare;
++#else
+ php_driver_collection_handlers.std.compare_objects = php_driver_collection_compare;
++#endif
++#endif
+ php_driver_collection_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_collection_ce->create_object = php_driver_collection_new;
+ zend_class_implements(php_driver_collection_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
+diff --git a/ext/src/Date.c b/ext/src/Date.c
+index 91dce9ea..79d67883 100644
+--- a/ext/src/Date.c
++++ b/ext/src/Date.c
+@@ -117,7 +117,11 @@ PHP_METHOD(Date, toDateTime)
+ PHP_METHOD(Date, fromDateTime)
+ {
+ php_driver_date *self;
++#if PHP_VERSION_ID >= 80000
++ zend_object *zdatetime;
++#else
+ zval *zdatetime;
++#endif
+ php5to7_zval retval;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zdatetime) == FAILURE) {
+@@ -188,7 +192,13 @@ static zend_function_entry php_driver_date_methods[] = {
+ static php_driver_value_handlers php_driver_date_handlers;
+
+ static HashTable *
+-php_driver_date_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_date_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -196,12 +206,24 @@ php_driver_date_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_date_properties(zval *object TSRMLS_DC)
++php_driver_date_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval seconds;
+
+- php_driver_date *self = PHP_DRIVER_GET_DATE(object);
++ php_driver_date *self = PHP_DRIVER_GET_DATE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_DATE TSRMLS_CC);
+@@ -267,7 +289,15 @@ void php_driver_define_Date(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_date_handlers.std.get_gc = php_driver_date_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_date_handlers.std.compare = php_driver_date_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_date_handlers.std.compare = php_driver_date_compare;
++#else
+ php_driver_date_handlers.std.compare_objects = php_driver_date_compare;
++#endif
++#endif
+ php_driver_date_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_date_ce->create_object = php_driver_date_new;
+
+diff --git a/ext/src/Decimal.c b/ext/src/Decimal.c
+index 916afc14..31565975 100644
+--- a/ext/src/Decimal.c
++++ b/ext/src/Decimal.c
+@@ -512,7 +512,13 @@ static zend_function_entry php_driver_decimal_methods[] = {
+ static php_driver_value_handlers php_driver_decimal_handlers;
+
+ static HashTable*
+-php_driver_decimal_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_decimal_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -520,7 +526,13 @@ php_driver_decimal_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable*
+-php_driver_decimal_properties(zval *object TSRMLS_DC)
++php_driver_decimal_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++ )
+ {
+ char* string;
+ int string_len;
+@@ -528,7 +540,13 @@ php_driver_decimal_properties(zval *object TSRMLS_DC)
+ php5to7_zval value;
+ php5to7_zval scale;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_DECIMAL TSRMLS_CC);
+@@ -576,9 +594,21 @@ php_driver_decimal_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_decimal_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_decimal_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -633,7 +663,15 @@ void php_driver_define_Decimal(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_decimal_handlers.std.get_gc = php_driver_decimal_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_decimal_handlers.std.compare = php_driver_decimal_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_decimal_handlers.std.compare = php_driver_decimal_compare;
++#else
+ php_driver_decimal_handlers.std.compare_objects = php_driver_decimal_compare;
++#endif
++#endif
+ php_driver_decimal_handlers.std.cast_object = php_driver_decimal_cast;
+
+ php_driver_decimal_handlers.hash_value = php_driver_decimal_hash_value;
+diff --git a/ext/src/DefaultAggregate.c b/ext/src/DefaultAggregate.c
+index 57c6036a..09b9703a 100644
+--- a/ext/src/DefaultAggregate.c
++++ b/ext/src/DefaultAggregate.c
+@@ -214,7 +214,13 @@ static zend_function_entry php_driver_default_aggregate_methods[] = {
+ static zend_object_handlers php_driver_default_aggregate_handlers;
+
+ static HashTable *
+-php_driver_type_default_aggregate_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_aggregate_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -222,7 +228,13 @@ php_driver_type_default_aggregate_gc(zval *object, php5to7_zval_gc table, int *n
+ }
+
+ static HashTable *
+-php_driver_default_aggregate_properties(zval *object TSRMLS_DC)
++php_driver_default_aggregate_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++ )
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -298,6 +310,14 @@ void php_driver_define_DefaultAggregate(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_aggregate_handlers.get_gc = php_driver_type_default_aggregate_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_aggregate_handlers.compare = php_driver_default_aggregate_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_aggregate_handlers.compare = php_driver_default_aggregate_compare;
++#else
+ php_driver_default_aggregate_handlers.compare_objects = php_driver_default_aggregate_compare;
++#endif
++#endif
+ php_driver_default_aggregate_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultCluster.c b/ext/src/DefaultCluster.c
+index 8f88d419..0b9fccb7 100644
+--- a/ext/src/DefaultCluster.c
++++ b/ext/src/DefaultCluster.c
+@@ -53,6 +53,8 @@ PHP_METHOD(DefaultCluster, connect)
+ session->default_consistency = self->default_consistency;
+ session->default_page_size = self->default_page_size;
+ session->persist = self->persist;
++ session->hash_key = self->hash_key;
++ session->keyspace = keyspace;
+
+ if (!PHP5TO7_ZVAL_IS_UNDEF(session->default_timeout)) {
+ PHP5TO7_ZVAL_COPY(PHP5TO7_ZVAL_MAYBE_P(session->default_timeout),
+@@ -156,8 +158,10 @@ PHP_METHOD(DefaultCluster, connectAsync)
+ hash_key_len = spprintf(&hash_key, 0, "%s:session:%s",
+ self->hash_key, SAFE_STR(keyspace));
+
+- future->hash_key = hash_key;
+- future->hash_key_len = hash_key_len;
++ future->session_hash_key = self->hash_key;
++ future->session_keyspace = keyspace;
++ future->hash_key = hash_key;
++ future->hash_key_len = hash_key_len;
+
+ if (PHP5TO7_ZEND_HASH_FIND(&EG(persistent_list), hash_key, hash_key_len + 1, le) &&
+ Z_RES_P(le)->type == php_le_php_driver_session()) {
+@@ -218,7 +222,13 @@ static zend_function_entry php_driver_default_cluster_methods[] = {
+ static zend_object_handlers php_driver_default_cluster_handlers;
+
+ static HashTable *
+-php_driver_default_cluster_properties(zval *object TSRMLS_DC)
++php_driver_default_cluster_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++ )
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -282,5 +292,13 @@ void php_driver_define_DefaultCluster(TSRMLS_D)
+
+ memcpy(&php_driver_default_cluster_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_cluster_handlers.get_properties = php_driver_default_cluster_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_cluster_handlers.compare = php_driver_default_cluster_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_cluster_handlers.compare = php_driver_default_cluster_compare;
++#else
+ php_driver_default_cluster_handlers.compare_objects = php_driver_default_cluster_compare;
++#endif
++#endif
+ }
+diff --git a/ext/src/DefaultColumn.c b/ext/src/DefaultColumn.c
+index a990a6e0..f36645ef 100644
+--- a/ext/src/DefaultColumn.c
++++ b/ext/src/DefaultColumn.c
+@@ -221,7 +221,13 @@ static zend_function_entry php_driver_default_column_methods[] = {
+ static zend_object_handlers php_driver_default_column_handlers;
+
+ static HashTable *
+-php_driver_type_default_column_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_column_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -229,7 +235,13 @@ php_driver_type_default_column_gc(zval *object, php5to7_zval_gc table, int *n TS
+ }
+
+ static HashTable *
+-php_driver_default_column_properties(zval *object TSRMLS_DC)
++php_driver_default_column_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -294,6 +306,14 @@ void php_driver_define_DefaultColumn(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_column_handlers.get_gc = php_driver_type_default_column_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_column_handlers.compare = php_driver_default_column_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_column_handlers.compare = php_driver_default_column_compare;
++#else
+ php_driver_default_column_handlers.compare_objects = php_driver_default_column_compare;
++#endif
++#endif
+ php_driver_default_column_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultFunction.c b/ext/src/DefaultFunction.c
+index fd9a696d..5ef3bcc6 100644
+--- a/ext/src/DefaultFunction.c
++++ b/ext/src/DefaultFunction.c
+@@ -207,7 +207,13 @@ static zend_function_entry php_driver_default_function_methods[] = {
+ static zend_object_handlers php_driver_default_function_handlers;
+
+ static HashTable *
+-php_driver_type_default_function_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_function_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -215,7 +221,13 @@ php_driver_type_default_function_gc(zval *object, php5to7_zval_gc table, int *n
+ }
+
+ static HashTable *
+-php_driver_default_function_properties(zval *object TSRMLS_DC)
++php_driver_default_function_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -287,6 +299,14 @@ void php_driver_define_DefaultFunction(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_function_handlers.get_gc = php_driver_type_default_function_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_function_handlers.compare = php_driver_default_function_compare;
++#else
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_function_handlers.compare = php_driver_default_function_compare;
++#else
+ php_driver_default_function_handlers.compare_objects = php_driver_default_function_compare;
++#endif
++#endif
+ php_driver_default_function_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultIndex.c b/ext/src/DefaultIndex.c
+index 83fc5851..bb67ab6b 100644
+--- a/ext/src/DefaultIndex.c
++++ b/ext/src/DefaultIndex.c
+@@ -235,7 +235,13 @@ static zend_function_entry php_driver_default_index_methods[] = {
+ static zend_object_handlers php_driver_default_index_handlers;
+
+ static HashTable *
+-php_driver_type_default_index_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_index_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -243,7 +249,13 @@ php_driver_type_default_index_gc(zval *object, php5to7_zval_gc table, int *n TSR
+ }
+
+ static HashTable *
+-php_driver_default_index_properties(zval *object TSRMLS_DC)
++php_driver_default_index_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -311,6 +323,10 @@ void php_driver_define_DefaultIndex(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_index_handlers.get_gc = php_driver_type_default_index_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_index_handlers.compare = php_driver_default_index_compare;
++#else
+ php_driver_default_index_handlers.compare_objects = php_driver_default_index_compare;
++#endif
+ php_driver_default_index_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultKeyspace.c b/ext/src/DefaultKeyspace.c
+index 4e6af235..4d549e2c 100644
+--- a/ext/src/DefaultKeyspace.c
++++ b/ext/src/DefaultKeyspace.c
+@@ -516,7 +516,13 @@ static zend_function_entry php_driver_default_keyspace_methods[] = {
+ static zend_object_handlers php_driver_default_keyspace_handlers;
+
+ static HashTable *
+-php_driver_type_default_keyspace_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_keyspace_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -524,7 +530,13 @@ php_driver_type_default_keyspace_gc(zval *object, php5to7_zval_gc table, int *n
+ }
+
+ static HashTable *
+-php_driver_default_keyspace_properties(zval *object TSRMLS_DC)
++php_driver_default_keyspace_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -582,6 +594,10 @@ void php_driver_define_DefaultKeyspace(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_keyspace_handlers.get_gc = php_driver_type_default_keyspace_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_keyspace_handlers.compare = php_driver_default_keyspace_compare;
++#else
+ php_driver_default_keyspace_handlers.compare_objects = php_driver_default_keyspace_compare;
++#endif
+ php_driver_default_keyspace_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultMaterializedView.c b/ext/src/DefaultMaterializedView.c
+index a1bb2e26..4d1df7eb 100644
+--- a/ext/src/DefaultMaterializedView.c
++++ b/ext/src/DefaultMaterializedView.c
+@@ -578,7 +578,13 @@ static zend_function_entry php_driver_default_materialized_view_methods[] = {
+ static zend_object_handlers php_driver_default_materialized_view_handlers;
+
+ static HashTable *
+-php_driver_type_default_materialized_view_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_materialized_view_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -586,7 +592,13 @@ php_driver_type_default_materialized_view_gc(zval *object, php5to7_zval_gc table
+ }
+
+ static HashTable *
+-php_driver_default_materialized_view_properties(zval *object TSRMLS_DC)
++php_driver_default_materialized_view_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -659,6 +671,10 @@ void php_driver_define_DefaultMaterializedView(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_materialized_view_handlers.get_gc = php_driver_type_default_materialized_view_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_materialized_view_handlers.compare = php_driver_default_materialized_view_compare;
++#else
+ php_driver_default_materialized_view_handlers.compare_objects = php_driver_default_materialized_view_compare;
++#endif
+ php_driver_default_materialized_view_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultSchema.c b/ext/src/DefaultSchema.c
+index c6448554..aa1d5db8 100644
+--- a/ext/src/DefaultSchema.c
++++ b/ext/src/DefaultSchema.c
+@@ -113,7 +113,13 @@ static zend_function_entry php_driver_default_schema_methods[] = {
+ static zend_object_handlers php_driver_default_schema_handlers;
+
+ static HashTable *
+-php_driver_default_schema_properties(zval *object TSRMLS_DC)
++php_driver_default_schema_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -166,6 +172,10 @@ void php_driver_define_DefaultSchema(TSRMLS_D)
+
+ memcpy(&php_driver_default_schema_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_schema_handlers.get_properties = php_driver_default_schema_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_schema_handlers.compare = php_driver_default_schema_compare;
++#else
+ php_driver_default_schema_handlers.compare_objects = php_driver_default_schema_compare;
++#endif
+ php_driver_default_schema_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultSession.c b/ext/src/DefaultSession.c
+index 4fea3fbd..8aa701cf 100644
+--- a/ext/src/DefaultSession.c
++++ b/ext/src/DefaultSession.c
+@@ -15,6 +15,7 @@
+ */
+
+ #include "php_driver.h"
++#include "php_driver_globals.h"
+ #include "php_driver_types.h"
+ #include "util/bytes.h"
+ #include "util/future.h"
+@@ -813,16 +814,25 @@ PHP_METHOD(DefaultSession, executeAsync)
+ }
+ }
+
++static void
++free_prepared_statement(void *future)
++{
++ cass_future_free((CassFuture*) future);
++}
++
+ PHP_METHOD(DefaultSession, prepare)
+ {
+ zval *cql = NULL;
+ zval *options = NULL;
++ char *hash_key = NULL;
++ php5to7_size hash_key_len = 0;
+ php_driver_session *self = NULL;
+ php_driver_execution_options *opts = NULL;
+ php_driver_execution_options local_opts;
+ CassFuture *future = NULL;
+ zval *timeout = NULL;
+ php_driver_statement *prepared_statement = NULL;
++ php_driver_pprepared_statement *pprepared_statement = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &cql, &options) == FAILURE) {
+ return;
+@@ -847,17 +857,66 @@ PHP_METHOD(DefaultSession, prepare)
+ timeout = PHP5TO7_ZVAL_MAYBE_P(opts->timeout);
+ }
+
+- future = cass_session_prepare_n((CassSession *)self->session->data,
+- Z_STRVAL_P(cql), Z_STRLEN_P(cql));
++ if(self->persist) {
++ php5to7_zend_resource_le *le;
++
++ spprintf(&hash_key, 0, "%s%s", self->hash_key, Z_STRVAL_P(cql));
++ hash_key_len = spprintf(&hash_key, 0, "%s:prepared_statement:%s",
++ hash_key, SAFE_STR(self->keyspace));
++
++ if (PHP5TO7_ZEND_HASH_FIND(&EG(persistent_list), hash_key, hash_key_len + 1, le) &&
++ Z_RES_P(le)->type == php_le_php_driver_prepared_statement()) {
++ pprepared_statement = (php_driver_pprepared_statement *) Z_RES_P(le)->ptr;
++ object_init_ex(return_value, php_driver_prepared_statement_ce);
++ prepared_statement = PHP_DRIVER_GET_STATEMENT(return_value);
++ prepared_statement->data.prepared.prepared = cass_future_get_prepared(pprepared_statement->future);
++ self->session = php_driver_add_ref(pprepared_statement->ref);
++ future = pprepared_statement->future;
++ }
++ }
+
+- if (php_driver_future_wait_timed(future, timeout TSRMLS_CC) == SUCCESS &&
+- php_driver_future_is_error(future TSRMLS_CC) == SUCCESS) {
+- object_init_ex(return_value, php_driver_prepared_statement_ce);
+- prepared_statement = PHP_DRIVER_GET_STATEMENT(return_value);
+- prepared_statement->data.prepared.prepared = cass_future_get_prepared(future);
++ if (future == NULL) {
++ php5to7_zend_resource_le resource;
++
++ future = cass_session_prepare_n((CassSession *)self->session->data,
++ Z_STRVAL_P(cql), Z_STRLEN_P(cql));
++
++ if (php_driver_future_wait_timed(future, timeout TSRMLS_CC) == SUCCESS &&
++ php_driver_future_is_error(future TSRMLS_CC) == SUCCESS) {
++ object_init_ex(return_value, php_driver_prepared_statement_ce);
++ prepared_statement = PHP_DRIVER_GET_STATEMENT(return_value);
++ prepared_statement->data.prepared.prepared = cass_future_get_prepared(future);
++
++ if(self->persist) {
++ pprepared_statement = (php_driver_pprepared_statement *) pecalloc(1, sizeof(php_driver_pprepared_statement), 1);
++ pprepared_statement->ref = php_driver_new_peref(future, free_prepared_statement, 1);
++ pprepared_statement->ref = php_driver_add_ref(self->session);
++ pprepared_statement->future = future;
++
++ #if PHP_MAJOR_VERSION >= 7
++ ZVAL_NEW_PERSISTENT_RES(&resource, 0, pprepared_statement, php_le_php_driver_prepared_statement());
++ PHP5TO7_ZEND_HASH_UPDATE(&EG(persistent_list), hash_key, hash_key_len + 1, &resource, sizeof(php5to7_zend_resource_le));
++ PHP_DRIVER_G(persistent_prepared_statements)++;
++ #else
++ resource.type = php_le_php_driver_prepared_statement();
++ resource.ptr = pprepared_statement;
++ PHP5TO7_ZEND_HASH_UPDATE(&EG(persistent_list), hash_key, hash_key_len + 1, resource, sizeof(php5to7_zend_resource_le));
++ PHP_DRIVER_G(persistent_prepared_statements)++;
++ #endif
++ }
++ }
++ }
++
++ if (self->persist) {
++ if (php_driver_future_is_error(future TSRMLS_CC) == FAILURE) {
++ (void) PHP5TO7_ZEND_HASH_DEL(&EG(persistent_list), hash_key, hash_key_len + 1);
++ }
++ efree(hash_key);
++ }
++ else {
++ cass_future_free(future);
+ }
+
+- cass_future_free(future);
+ }
+
+ PHP_METHOD(DefaultSession, prepareAsync)
+@@ -1070,7 +1129,13 @@ static zend_function_entry php_driver_default_session_methods[] = {
+ static zend_object_handlers php_driver_default_session_handlers;
+
+ static HashTable *
+-php_driver_default_session_properties(zval *object TSRMLS_DC)
++php_driver_default_session_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -1108,6 +1173,8 @@ php_driver_default_session_new(zend_class_entry *ce TSRMLS_DC)
+ self->persist = 0;
+ self->default_consistency = PHP_DRIVER_DEFAULT_CONSISTENCY;
+ self->default_page_size = 5000;
++ self->keyspace = NULL;
++ self->hash_key = NULL;
+ PHP5TO7_ZVAL_UNDEF(self->default_timeout);
+
+ PHP5TO7_ZEND_OBJECT_INIT_EX(session, default_session, self, ce);
+@@ -1125,6 +1192,10 @@ void php_driver_define_DefaultSession(TSRMLS_D)
+
+ memcpy(&php_driver_default_session_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_session_handlers.get_properties = php_driver_default_session_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_session_handlers.compare = php_driver_default_session_compare;
++#else
+ php_driver_default_session_handlers.compare_objects = php_driver_default_session_compare;
++#endif
+ php_driver_default_session_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultTable.c b/ext/src/DefaultTable.c
+index 82f20306..c033f56b 100644
+--- a/ext/src/DefaultTable.c
++++ b/ext/src/DefaultTable.c
+@@ -383,7 +383,7 @@ PHP_METHOD(DefaultTable, column)
+ self = PHP_DRIVER_GET_TABLE(getThis());
+ meta = cass_table_meta_column_by_name(self->meta, name);
+ if (meta == NULL) {
+- RETURN_FALSE
++ RETURN_FALSE;
+ }
+
+ column = php_driver_create_column(self->schema, meta TSRMLS_CC);
+@@ -686,7 +686,13 @@ static zend_function_entry php_driver_default_table_methods[] = {
+ static zend_object_handlers php_driver_default_table_handlers;
+
+ static HashTable *
+-php_driver_type_default_table_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_default_table_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -694,7 +700,13 @@ php_driver_type_default_table_gc(zval *object, php5to7_zval_gc table, int *n TSR
+ }
+
+ static HashTable *
+-php_driver_default_table_properties(zval *object TSRMLS_DC)
++php_driver_default_table_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -766,6 +778,10 @@ void php_driver_define_DefaultTable(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_table_handlers.get_gc = php_driver_type_default_table_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_default_table_handlers.compare = php_driver_default_table_compare;
++#else
+ php_driver_default_table_handlers.compare_objects = php_driver_default_table_compare;
++#endif
+ php_driver_default_table_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Duration.c b/ext/src/Duration.c
+index efa574d8..b24b3997 100644
+--- a/ext/src/Duration.c
++++ b/ext/src/Duration.c
+@@ -226,10 +226,22 @@ static zend_function_entry php_driver_duration_methods[] = {
+ static php_driver_value_handlers php_driver_duration_handlers;
+
+ static HashTable *
+-php_driver_duration_properties(zval *object TSRMLS_DC)
++php_driver_duration_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+- php_driver_duration *self = PHP_DRIVER_GET_DURATION(object);
++ php_driver_duration *self = PHP_DRIVER_GET_DURATION(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ php5to7_zval wrapped_months, wrapped_days, wrapped_nanos;
+ PHP5TO7_ZVAL_MAYBE_MAKE(wrapped_months);
+@@ -322,7 +334,11 @@ void php_driver_define_Duration(TSRMLS_D)
+
+ memcpy(&php_driver_duration_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_duration_handlers.std.get_properties = php_driver_duration_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_duration_handlers.std.compare = php_driver_duration_compare;
++#else
+ php_driver_duration_handlers.std.compare_objects = php_driver_duration_compare;
++#endif
+
+ php_driver_duration_handlers.hash_value = php_driver_duration_hash_value;
+ php_driver_duration_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/ExecutionOptions.c b/ext/src/ExecutionOptions.c
+index c1c8d609..13240f0d 100644
+--- a/ext/src/ExecutionOptions.c
++++ b/ext/src/ExecutionOptions.c
+@@ -248,7 +248,13 @@ static zend_function_entry php_driver_execution_options_methods[] = {
+ static zend_object_handlers php_driver_execution_options_handlers;
+
+ static HashTable *
+-php_driver_execution_options_properties(zval *object TSRMLS_DC)
++php_driver_execution_options_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -303,6 +309,10 @@ void php_driver_define_ExecutionOptions(TSRMLS_D)
+
+ memcpy(&php_driver_execution_options_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_execution_options_handlers.get_properties = php_driver_execution_options_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_execution_options_handlers.compare = php_driver_execution_options_compare;
++#else
+ php_driver_execution_options_handlers.compare_objects = php_driver_execution_options_compare;
++#endif
+ php_driver_execution_options_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Float.c b/ext/src/Float.c
+index 1ac790f2..f1b55261 100644
+--- a/ext/src/Float.c
++++ b/ext/src/Float.c
+@@ -372,7 +372,13 @@ static zend_function_entry php_driver_float_methods[] = {
+ static php_driver_value_handlers php_driver_float_handlers;
+
+ static HashTable *
+-php_driver_float_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_float_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -380,12 +386,24 @@ php_driver_float_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_float_properties(zval *object TSRMLS_DC)
++php_driver_float_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_FLOAT TSRMLS_CC);
+@@ -437,9 +455,21 @@ php_driver_float_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_float_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_float_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -490,7 +520,11 @@ void php_driver_define_Float(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_float_handlers.std.get_gc = php_driver_float_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_float_handlers.std.compare = php_driver_float_compare;
++#else
+ php_driver_float_handlers.std.compare_objects = php_driver_float_compare;
++#endif
+ php_driver_float_handlers.std.cast_object = php_driver_float_cast;
+
+ php_driver_float_handlers.hash_value = php_driver_float_hash_value;
+diff --git a/ext/src/FutureClose.c b/ext/src/FutureClose.c
+index 10217af0..d392b97a 100644
+--- a/ext/src/FutureClose.c
++++ b/ext/src/FutureClose.c
+@@ -49,7 +49,13 @@ static zend_function_entry php_driver_future_close_methods[] = {
+ static zend_object_handlers php_driver_future_close_handlers;
+
+ static HashTable *
+-php_driver_future_close_properties(zval *object TSRMLS_DC)
++php_driver_future_close_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -101,6 +107,10 @@ void php_driver_define_FutureClose(TSRMLS_D)
+
+ memcpy(&php_driver_future_close_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_close_handlers.get_properties = php_driver_future_close_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_future_close_handlers.compare = php_driver_future_close_compare;
++#else
+ php_driver_future_close_handlers.compare_objects = php_driver_future_close_compare;
++#endif
+ php_driver_future_close_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/FuturePreparedStatement.c b/ext/src/FuturePreparedStatement.c
+index 96e0f3c1..0337dd6d 100644
+--- a/ext/src/FuturePreparedStatement.c
++++ b/ext/src/FuturePreparedStatement.c
+@@ -63,7 +63,13 @@ static zend_function_entry php_driver_future_prepared_statement_methods[] = {
+ static zend_object_handlers php_driver_future_prepared_statement_handlers;
+
+ static HashTable *
+-php_driver_future_prepared_statement_properties(zval *object TSRMLS_DC)
++php_driver_future_prepared_statement_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -120,6 +126,10 @@ void php_driver_define_FuturePreparedStatement(TSRMLS_D)
+
+ memcpy(&php_driver_future_prepared_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_prepared_statement_handlers.get_properties = php_driver_future_prepared_statement_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_future_prepared_statement_handlers.compare = php_driver_future_prepared_statement_compare;
++#else
+ php_driver_future_prepared_statement_handlers.compare_objects = php_driver_future_prepared_statement_compare;
++#endif
+ php_driver_future_prepared_statement_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/FutureRows.c b/ext/src/FutureRows.c
+index 5ae9dbab..427ad35f 100644
+--- a/ext/src/FutureRows.c
++++ b/ext/src/FutureRows.c
+@@ -103,7 +103,13 @@ static zend_function_entry php_driver_future_rows_methods[] = {
+ static zend_object_handlers php_driver_future_rows_handlers;
+
+ static HashTable *
+-php_driver_future_rows_properties(zval *object TSRMLS_DC)
++php_driver_future_rows_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -165,6 +171,10 @@ void php_driver_define_FutureRows(TSRMLS_D)
+
+ memcpy(&php_driver_future_rows_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_rows_handlers.get_properties = php_driver_future_rows_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_future_rows_handlers.compare = php_driver_future_rows_compare;
++#else
+ php_driver_future_rows_handlers.compare_objects = php_driver_future_rows_compare;
++#endif
+ php_driver_future_rows_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/FutureSession.c b/ext/src/FutureSession.c
+index 3c622f6e..9452c1aa 100644
+--- a/ext/src/FutureSession.c
++++ b/ext/src/FutureSession.c
+@@ -95,7 +95,13 @@ static zend_function_entry php_driver_future_session_methods[] = {
+ static zend_object_handlers php_driver_future_session_handlers;
+
+ static HashTable *
+-php_driver_future_session_properties(zval *object TSRMLS_DC)
++php_driver_future_session_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -166,6 +172,10 @@ void php_driver_define_FutureSession(TSRMLS_D)
+
+ memcpy(&php_driver_future_session_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_session_handlers.get_properties = php_driver_future_session_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_future_session_handlers.compare = php_driver_future_session_compare;
++#else
+ php_driver_future_session_handlers.compare_objects = php_driver_future_session_compare;
++#endif
+ php_driver_future_session_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/FutureValue.c b/ext/src/FutureValue.c
+index bcd5dd3d..6c5f50ea 100644
+--- a/ext/src/FutureValue.c
++++ b/ext/src/FutureValue.c
+@@ -46,7 +46,13 @@ static zend_function_entry php_driver_future_value_methods[] = {
+ static zend_object_handlers php_driver_future_value_handlers;
+
+ static HashTable *
+-php_driver_future_value_properties(zval *object TSRMLS_DC)
++php_driver_future_value_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -97,6 +103,10 @@ void php_driver_define_FutureValue(TSRMLS_D)
+
+ memcpy(&php_driver_future_value_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_value_handlers.get_properties = php_driver_future_value_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_future_value_handlers.compare = php_driver_future_value_compare;
++#else
+ php_driver_future_value_handlers.compare_objects = php_driver_future_value_compare;
++#endif
+ php_driver_future_value_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Inet.c b/ext/src/Inet.c
+index 2c64b985..fd5d8848 100644
+--- a/ext/src/Inet.c
++++ b/ext/src/Inet.c
+@@ -101,7 +101,13 @@ static zend_function_entry php_driver_inet_methods[] = {
+ static php_driver_value_handlers php_driver_inet_handlers;
+
+ static HashTable *
+-php_driver_inet_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_inet_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -109,13 +115,25 @@ php_driver_inet_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_inet_properties(zval *object TSRMLS_DC)
++php_driver_inet_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ char *string;
+ php5to7_zval type;
+ php5to7_zval address;
+
+- php_driver_inet *self = PHP_DRIVER_GET_INET(object);
++ php_driver_inet *self = PHP_DRIVER_GET_INET(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_INET TSRMLS_CC);
+@@ -186,7 +204,11 @@ void php_driver_define_Inet(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_inet_handlers.std.get_gc = php_driver_inet_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_inet_handlers.std.compare = php_driver_inet_compare;
++#else
+ php_driver_inet_handlers.std.compare_objects = php_driver_inet_compare;
++#endif
+ php_driver_inet_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_inet_ce->create_object = php_driver_inet_new;
+
+diff --git a/ext/src/Map.c b/ext/src/Map.c
+index 2056b978..d58a759d 100644
+--- a/ext/src/Map.c
++++ b/ext/src/Map.c
+@@ -454,7 +454,13 @@ static zend_function_entry php_driver_map_methods[] = {
+ static php_driver_value_handlers php_driver_map_handlers;
+
+ static HashTable *
+-php_driver_map_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_map_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -462,12 +468,24 @@ php_driver_map_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_map_properties(zval *object TSRMLS_DC)
++php_driver_map_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval keys;
+ php5to7_zval values;
+
+- php_driver_map *self = PHP_DRIVER_GET_MAP(object);
++ php_driver_map *self = PHP_DRIVER_GET_MAP(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+
+@@ -597,7 +615,11 @@ void php_driver_define_Map(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_map_handlers.std.get_gc = php_driver_map_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_map_handlers.std.compare = php_driver_map_compare;
++#else
+ php_driver_map_handlers.std.compare_objects = php_driver_map_compare;
++#endif
+ php_driver_map_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_map_ce->create_object = php_driver_map_new;
+ zend_class_implements(php_driver_map_ce TSRMLS_CC, 3, spl_ce_Countable, zend_ce_iterator, zend_ce_arrayaccess);
+diff --git a/ext/src/PreparedStatement.c b/ext/src/PreparedStatement.c
+index 2366bc7d..d71e1937 100644
+--- a/ext/src/PreparedStatement.c
++++ b/ext/src/PreparedStatement.c
+@@ -23,15 +23,24 @@ PHP_METHOD(PreparedStatement, __construct)
+ {
+ }
+
++ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
++ZEND_END_ARG_INFO()
++
+ static zend_function_entry php_driver_prepared_statement_methods[] = {
+- PHP_ME(PreparedStatement, __construct, NULL, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
++ PHP_ME(PreparedStatement, __construct, arginfo_none, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR)
+ PHP_FE_END
+ };
+
+ static zend_object_handlers php_driver_prepared_statement_handlers;
+
+ static HashTable *
+-php_driver_prepared_statement_properties(zval *object TSRMLS_DC)
++php_driver_prepared_statement_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -83,6 +92,10 @@ void php_driver_define_PreparedStatement(TSRMLS_D)
+
+ memcpy(&php_driver_prepared_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_prepared_statement_handlers.get_properties = php_driver_prepared_statement_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_prepared_statement_handlers.compare = php_driver_prepared_statement_compare;
++#else
+ php_driver_prepared_statement_handlers.compare_objects = php_driver_prepared_statement_compare;
++#endif
+ php_driver_prepared_statement_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Rows.c b/ext/src/Rows.c
+index c2b00381..7ed21bd1 100644
+--- a/ext/src/Rows.c
++++ b/ext/src/Rows.c
+@@ -412,7 +412,13 @@ static zend_function_entry php_driver_rows_methods[] = {
+ static zend_object_handlers php_driver_rows_handlers;
+
+ static HashTable *
+-php_driver_rows_properties(zval *object TSRMLS_DC)
++php_driver_rows_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -475,6 +481,10 @@ void php_driver_define_Rows(TSRMLS_D)
+
+ memcpy(&php_driver_rows_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_rows_handlers.get_properties = php_driver_rows_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_rows_handlers.compare = php_driver_rows_compare;
++#else
+ php_driver_rows_handlers.compare_objects = php_driver_rows_compare;
++#endif
+ php_driver_rows_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/SSLOptions.c b/ext/src/SSLOptions.c
+index 42842961..0ce9467e 100644
+--- a/ext/src/SSLOptions.c
++++ b/ext/src/SSLOptions.c
+@@ -26,7 +26,13 @@ static zend_function_entry php_driver_ssl_methods[] = {
+ static zend_object_handlers php_driver_ssl_handlers;
+
+ static HashTable *
+-php_driver_ssl_properties(zval *object TSRMLS_DC)
++php_driver_ssl_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -75,6 +81,10 @@ void php_driver_define_SSLOptions(TSRMLS_D)
+
+ memcpy(&php_driver_ssl_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_ssl_handlers.get_properties = php_driver_ssl_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_ssl_handlers.compare = php_driver_ssl_compare;
++#else
+ php_driver_ssl_handlers.compare_objects = php_driver_ssl_compare;
++#endif
+ php_driver_ssl_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/SSLOptions/Builder.c b/ext/src/SSLOptions/Builder.c
+index ad62b84c..44a76a9e 100644
+--- a/ext/src/SSLOptions/Builder.c
++++ b/ext/src/SSLOptions/Builder.c
+@@ -273,7 +273,13 @@ static zend_function_entry php_driver_ssl_builder_methods[] = {
+ static zend_object_handlers php_driver_ssl_builder_handlers;
+
+ static HashTable *
+-php_driver_ssl_builder_properties(zval *object TSRMLS_DC)
++php_driver_ssl_builder_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -343,5 +349,9 @@ void php_driver_define_SSLOptionsBuilder(TSRMLS_D)
+
+ memcpy(&php_driver_ssl_builder_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_ssl_builder_handlers.get_properties = php_driver_ssl_builder_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_ssl_builder_handlers.compare = php_driver_ssl_builder_compare;
++#else
+ php_driver_ssl_builder_handlers.compare_objects = php_driver_ssl_builder_compare;
++#endif
+ }
+diff --git a/ext/src/Set.c b/ext/src/Set.c
+index 58882e99..f018a0c3 100644
+--- a/ext/src/Set.c
++++ b/ext/src/Set.c
+@@ -299,7 +299,13 @@ static zend_function_entry php_driver_set_methods[] = {
+ static php_driver_value_handlers php_driver_set_handlers;
+
+ static HashTable *
+-php_driver_set_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_set_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -307,11 +313,23 @@ php_driver_set_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_set_properties(zval *object TSRMLS_DC)
++php_driver_set_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval values;
+
+- php_driver_set *self = PHP_DRIVER_GET_SET(object);
++ php_driver_set *self = PHP_DRIVER_GET_SET(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+
+@@ -429,7 +447,11 @@ void php_driver_define_Set(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_set_handlers.std.get_gc = php_driver_set_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_set_handlers.std.compare = php_driver_set_compare;
++#else
+ php_driver_set_handlers.std.compare_objects = php_driver_set_compare;
++#endif
+ php_driver_set_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_set_ce->create_object = php_driver_set_new;
+ zend_class_implements(php_driver_set_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
+diff --git a/ext/src/SimpleStatement.c b/ext/src/SimpleStatement.c
+index 7aea053d..6aa5cf8e 100644
+--- a/ext/src/SimpleStatement.c
++++ b/ext/src/SimpleStatement.c
+@@ -49,7 +49,13 @@ static zend_function_entry php_driver_simple_statement_methods[] = {
+ static zend_object_handlers php_driver_simple_statement_handlers;
+
+ static HashTable *
+-php_driver_simple_statement_properties(zval *object TSRMLS_DC)
++php_driver_simple_statement_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -103,6 +109,10 @@ void php_driver_define_SimpleStatement(TSRMLS_D)
+
+ memcpy(&php_driver_simple_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_simple_statement_handlers.get_properties = php_driver_simple_statement_properties;
++#if PHP_VERSION_ID >= 80000
++ php_driver_simple_statement_handlers.compare = php_driver_simple_statement_compare;
++#else
+ php_driver_simple_statement_handlers.compare_objects = php_driver_simple_statement_compare;
++#endif
+ php_driver_simple_statement_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Smallint.c b/ext/src/Smallint.c
+index b817e665..5683af98 100644
+--- a/ext/src/Smallint.c
++++ b/ext/src/Smallint.c
+@@ -426,7 +426,13 @@ static zend_function_entry php_driver_smallint_methods[] = {
+ static php_driver_value_handlers php_driver_smallint_handlers;
+
+ static HashTable *
+-php_driver_smallint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_smallint_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -434,12 +440,24 @@ php_driver_smallint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_smallint_properties(zval *object TSRMLS_DC)
++php_driver_smallint_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_SMALL_INT TSRMLS_CC);
+@@ -480,9 +498,21 @@ php_driver_smallint_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_smallint_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_smallint_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -533,7 +563,11 @@ void php_driver_define_Smallint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_smallint_handlers.std.get_gc = php_driver_smallint_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_smallint_handlers.std.compare = php_driver_smallint_compare;
++#else
+ php_driver_smallint_handlers.std.compare_objects = php_driver_smallint_compare;
++#endif
+ php_driver_smallint_handlers.std.cast_object = php_driver_smallint_cast;
+
+ php_driver_smallint_handlers.hash_value = php_driver_smallint_hash_value;
+diff --git a/ext/src/Time.c b/ext/src/Time.c
+index 39fb4a74..b364f833 100644
+--- a/ext/src/Time.c
++++ b/ext/src/Time.c
+@@ -151,7 +151,11 @@ PHP_METHOD(Time, seconds)
+ PHP_METHOD(Time, fromDateTime)
+ {
+ php_driver_time *self;
++#if PHP_VERSION_ID >= 80000
++ zend_object *zdatetime;
++#else
+ zval *zdatetime;
++#endif
+ php5to7_zval retval;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zdatetime) == FAILURE) {
+@@ -212,7 +216,13 @@ static zend_function_entry php_driver_time_methods[] = {
+ static php_driver_value_handlers php_driver_time_handlers;
+
+ static HashTable *
+-php_driver_time_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_time_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -220,12 +230,24 @@ php_driver_time_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_time_properties(zval *object TSRMLS_DC)
++php_driver_time_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval nanoseconds;
+
+- php_driver_time *self = PHP_DRIVER_GET_TIME(object);
++ php_driver_time *self = PHP_DRIVER_GET_TIME(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TIME TSRMLS_CC);
+@@ -291,7 +313,11 @@ void php_driver_define_Time(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_time_handlers.std.get_gc = php_driver_time_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_time_handlers.std.compare = php_driver_time_compare;
++#else
+ php_driver_time_handlers.std.compare_objects = php_driver_time_compare;
++#endif
+ php_driver_time_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_time_ce->create_object = php_driver_time_new;
+
+diff --git a/ext/src/Timestamp.c b/ext/src/Timestamp.c
+index ee9447ba..5098ac8e 100644
+--- a/ext/src/Timestamp.c
++++ b/ext/src/Timestamp.c
+@@ -176,17 +176,23 @@ ZEND_END_ARG_INFO()
+ static zend_function_entry php_driver_timestamp_methods[] = {
+ PHP_ME(Timestamp, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+ PHP_ME(Timestamp, type, arginfo_none, ZEND_ACC_PUBLIC)
+- PHP_ME(Timestamp, time, NULL, ZEND_ACC_PUBLIC)
++ PHP_ME(Timestamp, time, arginfo_none, ZEND_ACC_PUBLIC)
+ PHP_ME(Timestamp, microtime, arginfo_microtime, ZEND_ACC_PUBLIC)
+- PHP_ME(Timestamp, toDateTime, NULL, ZEND_ACC_PUBLIC)
+- PHP_ME(Timestamp, __toString, NULL, ZEND_ACC_PUBLIC)
++ PHP_ME(Timestamp, toDateTime, arginfo_none, ZEND_ACC_PUBLIC)
++ PHP_ME(Timestamp, __toString, arginfo_none, ZEND_ACC_PUBLIC)
+ PHP_FE_END
+ };
+
+ static php_driver_value_handlers php_driver_timestamp_handlers;
+
+ static HashTable *
+-php_driver_timestamp_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_timestamp_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -194,13 +200,25 @@ php_driver_timestamp_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_timestamp_properties(zval *object TSRMLS_DC)
++php_driver_timestamp_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval seconds;
+ php5to7_zval microseconds;
+
+- php_driver_timestamp *self = PHP_DRIVER_GET_TIMESTAMP(object);
++ php_driver_timestamp *self = PHP_DRIVER_GET_TIMESTAMP(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ long sec = (long) (self->timestamp / 1000);
+@@ -271,7 +289,11 @@ void php_driver_define_Timestamp(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_timestamp_handlers.std.get_gc = php_driver_timestamp_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_timestamp_handlers.std.compare = php_driver_timestamp_compare;
++#else
+ php_driver_timestamp_handlers.std.compare_objects = php_driver_timestamp_compare;
++#endif
+ php_driver_timestamp_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_timestamp_ce->create_object = php_driver_timestamp_new;
+
+diff --git a/ext/src/Timeuuid.c b/ext/src/Timeuuid.c
+index 0b4832fa..c94f753f 100644
+--- a/ext/src/Timeuuid.c
++++ b/ext/src/Timeuuid.c
+@@ -183,7 +183,13 @@ static zend_function_entry php_driver_timeuuid_methods[] = {
+ static php_driver_value_handlers php_driver_timeuuid_handlers;
+
+ static HashTable *
+-php_driver_timeuuid_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_timeuuid_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -191,14 +197,26 @@ php_driver_timeuuid_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_timeuuid_properties(zval *object TSRMLS_DC)
++php_driver_timeuuid_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ char string[CASS_UUID_STRING_LENGTH];
+ php5to7_zval type;
+ php5to7_zval uuid;
+ php5to7_zval version;
+
+- php_driver_uuid *self = PHP_DRIVER_GET_UUID(object);
++ php_driver_uuid *self = PHP_DRIVER_GET_UUID(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TIMEUUID TSRMLS_CC);
+@@ -276,7 +294,11 @@ php_driver_define_Timeuuid(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_timeuuid_handlers.std.get_gc = php_driver_timeuuid_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_timeuuid_handlers.std.compare = php_driver_timeuuid_compare;
++#else
+ php_driver_timeuuid_handlers.std.compare_objects = php_driver_timeuuid_compare;
++#endif
+ php_driver_timeuuid_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_timeuuid_ce->create_object = php_driver_timeuuid_new;
+
+diff --git a/ext/src/Tinyint.c b/ext/src/Tinyint.c
+index b7326dab..af6dcca4 100644
+--- a/ext/src/Tinyint.c
++++ b/ext/src/Tinyint.c
+@@ -425,7 +425,13 @@ static zend_function_entry php_driver_tinyint_methods[] = {
+ static php_driver_value_handlers php_driver_tinyint_handlers;
+
+ static HashTable *
+-php_driver_tinyint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_tinyint_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -433,12 +439,24 @@ php_driver_tinyint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_tinyint_properties(zval *object TSRMLS_DC)
++php_driver_tinyint_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TINY_INT TSRMLS_CC);
+@@ -479,9 +497,21 @@ php_driver_tinyint_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_tinyint_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_tinyint_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -532,7 +562,11 @@ void php_driver_define_Tinyint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_tinyint_handlers.std.get_gc = php_driver_tinyint_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_tinyint_handlers.std.compare = php_driver_tinyint_compare;
++#else
+ php_driver_tinyint_handlers.std.compare_objects = php_driver_tinyint_compare;
++#endif
+ php_driver_tinyint_handlers.std.cast_object = php_driver_tinyint_cast;
+
+ php_driver_tinyint_handlers.hash_value = php_driver_tinyint_hash_value;
+diff --git a/ext/src/Tuple.c b/ext/src/Tuple.c
+index 66168839..abc5f7a1 100644
+--- a/ext/src/Tuple.c
++++ b/ext/src/Tuple.c
+@@ -291,7 +291,13 @@ static zend_function_entry php_driver_tuple_methods[] = {
+ static php_driver_value_handlers php_driver_tuple_handlers;
+
+ static HashTable *
+-php_driver_tuple_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_tuple_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -299,11 +305,23 @@ php_driver_tuple_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_tuple_properties(zval *object TSRMLS_DC)
++php_driver_tuple_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval values;
+
+- php_driver_tuple *self = PHP_DRIVER_GET_TUPLE(object);
++ php_driver_tuple *self = PHP_DRIVER_GET_TUPLE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -426,7 +444,11 @@ void php_driver_define_Tuple(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_tuple_handlers.std.get_gc = php_driver_tuple_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_tuple_handlers.std.compare = php_driver_tuple_compare;
++#else
+ php_driver_tuple_handlers.std.compare_objects = php_driver_tuple_compare;
++#endif
+ php_driver_tuple_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_tuple_ce->create_object = php_driver_tuple_new;
+ zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
+diff --git a/ext/src/Type/Collection.c b/ext/src/Type/Collection.c
+index a85e0848..7e7500c1 100644
+--- a/ext/src/Type/Collection.c
++++ b/ext/src/Type/Collection.c
+@@ -128,7 +128,13 @@ static zend_function_entry php_driver_type_collection_methods[] = {
+ static zend_object_handlers php_driver_type_collection_handlers;
+
+ static HashTable *
+-php_driver_type_collection_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_collection_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -136,9 +142,21 @@ php_driver_type_collection_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS
+ }
+
+ static HashTable *
+-php_driver_type_collection_properties(zval *object TSRMLS_DC)
++php_driver_type_collection_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -193,7 +211,11 @@ void php_driver_define_TypeCollection(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_collection_handlers.get_gc = php_driver_type_collection_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_collection_handlers.compare = php_driver_type_collection_compare;
++#else
+ php_driver_type_collection_handlers.compare_objects = php_driver_type_collection_compare;
++#endif
+ php_driver_type_collection_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_collection_ce->create_object = php_driver_type_collection_new;
+ }
+diff --git a/ext/src/Type/Custom.c b/ext/src/Type/Custom.c
+index f751cb67..df9a4016 100644
+--- a/ext/src/Type/Custom.c
++++ b/ext/src/Type/Custom.c
+@@ -80,7 +80,13 @@ static zend_function_entry php_driver_type_custom_methods[] = {
+ static zend_object_handlers php_driver_type_custom_handlers;
+
+ static HashTable *
+-php_driver_type_custom_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_custom_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -88,11 +94,23 @@ php_driver_type_custom_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_type_custom_properties(zval *object TSRMLS_DC)
++php_driver_type_custom_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval name;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(name);
+@@ -151,7 +169,11 @@ void php_driver_define_TypeCustom(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_custom_handlers.get_gc = php_driver_type_custom_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_custom_handlers.compare = php_driver_type_custom_compare;
++#else
+ php_driver_type_custom_handlers.compare_objects = php_driver_type_custom_compare;
++#endif
+ php_driver_type_custom_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_custom_ce->create_object = php_driver_type_custom_new;
+ }
+diff --git a/ext/src/Type/Map.c b/ext/src/Type/Map.c
+index 2fd3b2f5..ffeb2042 100644
+--- a/ext/src/Type/Map.c
++++ b/ext/src/Type/Map.c
+@@ -145,7 +145,13 @@ static zend_function_entry php_driver_type_map_methods[] = {
+ static zend_object_handlers php_driver_type_map_handlers;
+
+ static HashTable *
+-php_driver_type_map_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_map_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -153,9 +159,21 @@ php_driver_type_map_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_type_map_properties(zval *object TSRMLS_DC)
++php_driver_type_map_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -218,7 +236,11 @@ void php_driver_define_TypeMap(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_map_handlers.get_gc = php_driver_type_map_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_map_handlers.compare = php_driver_type_map_compare;
++#else
+ php_driver_type_map_handlers.compare_objects = php_driver_type_map_compare;
++#endif
+ php_driver_type_map_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_map_ce->create_object = php_driver_type_map_new;
+ }
+diff --git a/ext/src/Type/Scalar.c b/ext/src/Type/Scalar.c
+index e01ae625..fd88e91c 100644
+--- a/ext/src/Type/Scalar.c
++++ b/ext/src/Type/Scalar.c
+@@ -83,7 +83,13 @@ static zend_function_entry php_driver_type_scalar_methods[] = {
+ static zend_object_handlers php_driver_type_scalar_handlers;
+
+ static HashTable *
+-php_driver_type_scalar_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_scalar_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -91,11 +97,23 @@ php_driver_type_scalar_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_type_scalar_properties(zval *object TSRMLS_DC)
++php_driver_type_scalar_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval name;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ /* Used for comparison and 'text' is just an alias for 'varchar' */
+@@ -154,7 +172,11 @@ void php_driver_define_TypeScalar(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_scalar_handlers.get_gc = php_driver_type_scalar_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_scalar_handlers.compare = php_driver_type_scalar_compare;
++#else
+ php_driver_type_scalar_handlers.compare_objects = php_driver_type_scalar_compare;
++#endif
+ php_driver_type_scalar_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_scalar_ce->create_object = php_driver_type_scalar_new;
+ }
+diff --git a/ext/src/Type/Set.c b/ext/src/Type/Set.c
+index faa2e95e..2e06ec10 100644
+--- a/ext/src/Type/Set.c
++++ b/ext/src/Type/Set.c
+@@ -120,7 +120,13 @@ static zend_function_entry php_driver_type_set_methods[] = {
+ static zend_object_handlers php_driver_type_set_handlers;
+
+ static HashTable *
+-php_driver_type_set_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_set_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -128,9 +134,21 @@ php_driver_type_set_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_type_set_properties(zval *object TSRMLS_DC)
++php_driver_type_set_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -186,7 +204,11 @@ void php_driver_define_TypeSet(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_set_handlers.get_gc = php_driver_type_set_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_set_handlers.compare = php_driver_type_set_compare;
++#else
+ php_driver_type_set_handlers.compare_objects = php_driver_type_set_compare;
++#endif
+ php_driver_type_set_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_set_ce->create_object = php_driver_type_set_new;
+ }
+diff --git a/ext/src/Type/Tuple.c b/ext/src/Type/Tuple.c
+index 816b808d..d081c798 100644
+--- a/ext/src/Type/Tuple.c
++++ b/ext/src/Type/Tuple.c
+@@ -156,7 +156,13 @@ static zend_function_entry php_driver_type_tuple_methods[] = {
+ static zend_object_handlers php_driver_type_tuple_handlers;
+
+ static HashTable *
+-php_driver_type_tuple_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_tuple_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -164,11 +170,23 @@ php_driver_type_tuple_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_type_tuple_properties(zval *object TSRMLS_DC)
++php_driver_type_tuple_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval types;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(types);
+@@ -225,7 +243,11 @@ void php_driver_define_TypeTuple(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_tuple_handlers.get_gc = php_driver_type_tuple_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_tuple_handlers.compare = php_driver_type_tuple_compare;
++#else
+ php_driver_type_tuple_handlers.compare_objects = php_driver_type_tuple_compare;
++#endif
+ php_driver_type_tuple_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_tuple_ce->create_object = php_driver_type_tuple_new;
+ }
+diff --git a/ext/src/Type/UserType.c b/ext/src/Type/UserType.c
+index 38393f39..a9f5dd83 100644
+--- a/ext/src/Type/UserType.c
++++ b/ext/src/Type/UserType.c
+@@ -261,7 +261,13 @@ static zend_function_entry php_driver_type_user_type_methods[] = {
+ static zend_object_handlers php_driver_type_user_type_handlers;
+
+ static HashTable *
+-php_driver_type_user_type_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_type_user_type_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -269,11 +275,23 @@ php_driver_type_user_type_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_
+ }
+
+ static HashTable *
+-php_driver_type_user_type_properties(zval *object TSRMLS_DC)
++php_driver_type_user_type_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval types;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(types);
+@@ -333,7 +351,11 @@ void php_driver_define_TypeUserType(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_user_type_handlers.get_gc = php_driver_type_user_type_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_type_user_type_handlers.compare = php_driver_type_user_type_compare;
++#else
+ php_driver_type_user_type_handlers.compare_objects = php_driver_type_user_type_compare;
++#endif
+ php_driver_type_user_type_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_type_user_type_ce->create_object = php_driver_type_user_type_new;
+ }
+diff --git a/ext/src/UserTypeValue.c b/ext/src/UserTypeValue.c
+index bac2c75d..f12c916e 100644
+--- a/ext/src/UserTypeValue.c
++++ b/ext/src/UserTypeValue.c
+@@ -55,17 +55,11 @@ php_driver_user_type_value_populate(php_driver_user_type_value *user_type_value,
+ size_t name_len = strlen(name);
+ (void) current;
+ if (PHP5TO7_ZEND_HASH_FIND(&user_type_value->values, name, name_len + 1, value)) {
+- if (PHP5TO7_ADD_ASSOC_ZVAL_EX(array, name, name_len + 1, PHP5TO7_ZVAL_MAYBE_DEREF(value)) == SUCCESS) {
+- Z_TRY_ADDREF_P(PHP5TO7_ZVAL_MAYBE_DEREF(value));
+- } else {
+- break;
+- }
++ PHP5TO7_ADD_ASSOC_ZVAL_EX(array, name, name_len + 1, PHP5TO7_ZVAL_MAYBE_DEREF(value));
++ Z_TRY_ADDREF_P(PHP5TO7_ZVAL_MAYBE_DEREF(value));
+ } else {
+- if (PHP5TO7_ADD_ASSOC_ZVAL_EX(array, name, name_len + 1, PHP5TO7_ZVAL_MAYBE_P(null)) == SUCCESS) {
+- Z_TRY_ADDREF_P(PHP5TO7_ZVAL_MAYBE_P(null));
+- } else {
+- break;
+- }
++ PHP5TO7_ADD_ASSOC_ZVAL_EX(array, name, name_len + 1, PHP5TO7_ZVAL_MAYBE_P(null));
++ Z_TRY_ADDREF_P(PHP5TO7_ZVAL_MAYBE_P(null));
+ }
+ } PHP5TO7_ZEND_HASH_FOREACH_END(&type->data.udt.types);
+
+@@ -337,7 +331,13 @@ static zend_function_entry php_driver_user_type_value_methods[] = {
+ static php_driver_value_handlers php_driver_user_type_value_handlers;
+
+ static HashTable *
+-php_driver_user_type_value_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_user_type_value_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -345,11 +345,23 @@ php_driver_user_type_value_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS
+ }
+
+ static HashTable *
+-php_driver_user_type_value_properties(zval *object TSRMLS_DC)
++php_driver_user_type_value_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ php5to7_zval values;
+
+- php_driver_user_type_value *self = PHP_DRIVER_GET_USER_TYPE_VALUE(object);
++ php_driver_user_type_value *self = PHP_DRIVER_GET_USER_TYPE_VALUE(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -472,7 +484,11 @@ void php_driver_define_UserTypeValue(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_user_type_value_handlers.std.get_gc = php_driver_user_type_value_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_user_type_value_handlers.std.compare = php_driver_user_type_value_compare;
++#else
+ php_driver_user_type_value_handlers.std.compare_objects = php_driver_user_type_value_compare;
++#endif
+ php_driver_user_type_value_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_user_type_value_ce->create_object = php_driver_user_type_value_new;
+ zend_class_implements(php_driver_user_type_value_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
+diff --git a/ext/src/Uuid.c b/ext/src/Uuid.c
+index af37360f..ef6c4a04 100644
+--- a/ext/src/Uuid.c
++++ b/ext/src/Uuid.c
+@@ -118,7 +118,13 @@ static zend_function_entry php_driver_uuid_methods[] = {
+ static php_driver_value_handlers php_driver_uuid_handlers;
+
+ static HashTable *
+-php_driver_uuid_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_uuid_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -126,14 +132,26 @@ php_driver_uuid_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_uuid_properties(zval *object TSRMLS_DC)
++php_driver_uuid_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ char string[CASS_UUID_STRING_LENGTH];
+ php5to7_zval type;
+ php5to7_zval uuid;
+ php5to7_zval version;
+
+- php_driver_uuid *self = PHP_DRIVER_GET_UUID(object);
++ php_driver_uuid *self = PHP_DRIVER_GET_UUID(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ cass_uuid_string(self->uuid, string);
+@@ -212,7 +230,11 @@ php_driver_define_Uuid(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_uuid_handlers.std.get_gc = php_driver_uuid_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_uuid_handlers.std.compare = php_driver_uuid_compare;
++#else
+ php_driver_uuid_handlers.std.compare_objects = php_driver_uuid_compare;
++#endif
+ php_driver_uuid_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_uuid_ce->create_object = php_driver_uuid_new;
+
+diff --git a/ext/src/Varint.c b/ext/src/Varint.c
+index 1e6adba7..2fff0e8b 100644
+--- a/ext/src/Varint.c
++++ b/ext/src/Varint.c
+@@ -371,7 +371,13 @@ static zend_function_entry php_driver_varint_methods[] = {
+ static php_driver_value_handlers php_driver_varint_handlers;
+
+ static HashTable *
+-php_driver_varint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
++php_driver_varint_gc(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ php5to7_zval_gc table, int *n TSRMLS_DC)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -379,14 +385,26 @@ php_driver_varint_gc(zval *object, php5to7_zval_gc table, int *n TSRMLS_DC)
+ }
+
+ static HashTable *
+-php_driver_varint_properties(zval *object TSRMLS_DC)
++php_driver_varint_properties(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object
++#else
++ zval *object TSRMLS_DC
++#endif
++)
+ {
+ char *string;
+ int string_len;
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ php_driver_format_integer(self->data.varint.value, &string, &string_len);
+@@ -425,9 +443,21 @@ php_driver_varint_hash_value(zval *obj TSRMLS_DC)
+ }
+
+ static int
+-php_driver_varint_cast(zval *object, zval *retval, int type TSRMLS_DC)
++php_driver_varint_cast(
++#if PHP_VERSION_ID >= 80000
++ zend_object *object,
++#else
++ zval *object,
++#endif
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
++#if PHP_VERSION_ID >= 80000
++ (zval*) object
++#else
++ object
++#endif
++ );
+
+ switch (type) {
+ case IS_LONG:
+@@ -480,7 +510,11 @@ void php_driver_define_Varint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_varint_handlers.std.get_gc = php_driver_varint_gc;
+ #endif
++#if PHP_VERSION_ID >= 80000
++ php_driver_varint_handlers.std.compare = php_driver_varint_compare;
++#else
+ php_driver_varint_handlers.std.compare_objects = php_driver_varint_compare;
++#endif
+ php_driver_varint_handlers.std.cast_object = php_driver_varint_cast;
+
+ php_driver_varint_handlers.hash_value = php_driver_varint_hash_value;
+diff --git a/ext/util/hash.c b/ext/util/hash.c
+index 706c365a..93b5f2a7 100644
+--- a/ext/util/hash.c
++++ b/ext/util/hash.c
+@@ -115,10 +115,18 @@ php_driver_value_compare(zval* zvalue1, zval* zvalue2 TSRMLS_DC) {
+
+ #if PHP_MAJOR_VERSION >= 7
+ case IS_OBJECT:
+- return Z_OBJ_P(zvalue1)->handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
++ #if PHP_VERSION_ID >= 80000
++ return Z_OBJ_P(zvalue1)->handlers->compare(zvalue1, zvalue2);
++ #else
++ return Z_OBJ_P(zvalue1)->handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
++ #endif
+ #else
+ case IS_OBJECT:
+- return Z_OBJVAL_P(zvalue1).handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
++ #if PHP_VERSION_ID >= 80000
++ return Z_OBJVAL_P(zvalue1).handlers->compare(zvalue1, zvalue2);
++ #else
++ return Z_OBJVAL_P(zvalue1).handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
++ #endif
+ #endif
+
+ default:
+From a782f23da294df9dc4f16f1a8a3dfc97bfc235b3 Mon Sep 17 00:00:00 2001
+From: Marko Dobromirovic <codespill.github@gmail.com>
+Date: Mon, 28 Dec 2020 21:59:30 +0100
+Subject: [PATCH] PHP 8 - fixing segfaults
+
+---
+ ext/php_driver.h | 2 +-
+ ext/src/BatchStatement.c | 11 ++++----
+ ext/src/Bigint.c | 37 +++++++++++++------------
+ ext/src/Blob.c | 26 +++++++++---------
+ ext/src/Cluster/Builder.c | 10 +++----
+ ext/src/Collection.c | 31 ++++++++++++---------
+ ext/src/Date.c | 32 +++++++++++-----------
+ ext/src/Decimal.c | 43 ++++++++++++++---------------
+ ext/src/DefaultAggregate.c | 18 ++++++-------
+ ext/src/DefaultCluster.c | 13 +++++----
+ ext/src/DefaultColumn.c | 24 ++++++++---------
+ ext/src/DefaultFunction.c | 24 ++++++++---------
+ ext/src/DefaultIndex.c | 20 ++++++++------
+ ext/src/DefaultKeyspace.c | 20 ++++++++------
+ ext/src/DefaultMaterializedView.c | 20 ++++++++------
+ ext/src/DefaultSchema.c | 11 +++++---
+ ext/src/DefaultSession.c | 11 +++++---
+ ext/src/DefaultTable.c | 20 ++++++++------
+ ext/src/Duration.c | 20 +++++++-------
+ ext/src/ExecutionOptions.c | 11 +++++---
+ ext/src/Float.c | 45 ++++++++++++++++---------------
+ ext/src/FutureClose.c | 11 +++++---
+ ext/src/FuturePreparedStatement.c | 11 +++++---
+ ext/src/FutureRows.c | 11 +++++---
+ ext/src/FutureSession.c | 11 +++++---
+ ext/src/FutureValue.c | 11 +++++---
+ ext/src/Inet.c | 28 ++++++++++---------
+ ext/src/Map.c | 28 ++++++++++---------
+ ext/src/PreparedStatement.c | 11 +++++---
+ ext/src/Rows.c | 17 +++++++++---
+ ext/src/SSLOptions.c | 11 +++++---
+ ext/src/SSLOptions/Builder.c | 4 +--
+ ext/src/Set.c | 28 ++++++++++---------
+ ext/src/SimpleStatement.c | 11 +++++---
+ ext/src/Smallint.c | 45 ++++++++++++++++---------------
+ ext/src/Time.c | 39 ++++++++++++++-------------
+ ext/src/Timestamp.c | 28 ++++++++++---------
+ ext/src/Timeuuid.c | 28 ++++++++++---------
+ ext/src/Tinyint.c | 45 ++++++++++++++++---------------
+ ext/src/Tuple.c | 40 ++++++++++++++++++---------
+ ext/src/Type.c | 4 +++
+ ext/src/Type/Collection.c | 32 +++++++++++++---------
+ ext/src/Type/Custom.c | 28 ++++++++++---------
+ ext/src/Type/Map.c | 32 +++++++++++++---------
+ ext/src/Type/Scalar.c | 29 ++++++++++----------
+ ext/src/Type/Set.c | 32 +++++++++++++---------
+ ext/src/Type/Tuple.c | 33 +++++++++++++----------
+ ext/src/Type/UserType.c | 32 +++++++++++++---------
+ ext/src/UserTypeValue.c | 41 ++++++++++++++++++----------
+ ext/src/Uuid.c | 28 ++++++++++---------
+ ext/src/Varint.c | 45 ++++++++++++++++---------------
+ ext/util/hash.c | 4 +--
+ 52 files changed, 677 insertions(+), 530 deletions(-)
+
+diff --git a/ext/php_driver.h b/ext/php_driver.h
+index 6fbc79bb..f9821525 100644
+--- a/ext/php_driver.h
++++ b/ext/php_driver.h
+@@ -46,7 +46,7 @@ typedef int pid_t;
+ # error PHP 5.6.0 or later is required in order to build the driver
+ #endif
+
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ #ifndef TSRMLS_D
+ #define TSRMLS_D void
+ #define TSRMLS_DC
+diff --git a/ext/src/BatchStatement.c b/ext/src/BatchStatement.c
+index 84e515ef..5f243214 100644
+--- a/ext/src/BatchStatement.c
++++ b/ext/src/BatchStatement.c
+@@ -125,7 +125,7 @@ static zend_object_handlers php_driver_batch_statement_handlers;
+
+ static HashTable *
+ php_driver_batch_statement_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object TSRMLS_DC
+ #else
+ zval *object TSRMLS_DC
+@@ -140,6 +140,9 @@ php_driver_batch_statement_properties(
+ static int
+ php_driver_batch_statement_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -182,14 +185,10 @@ void php_driver_define_BatchStatement(TSRMLS_D)
+
+ memcpy(&php_driver_batch_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_batch_statement_handlers.get_properties = php_driver_batch_statement_properties;
+-#if PHP_VERSION_ID >= 80000
+- php_driver_batch_statement_handlers.compare = php_driver_batch_statement_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_batch_statement_handlers.compare = php_driver_batch_statement_compare;
+ #else
+ php_driver_batch_statement_handlers.compare_objects = php_driver_batch_statement_compare;
+-#endif
+ #endif
+ php_driver_batch_statement_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/Bigint.c b/ext/src/Bigint.c
+index e412f23c..d66dae38 100644
+--- a/ext/src/Bigint.c
++++ b/ext/src/Bigint.c
+@@ -395,7 +395,7 @@ static php_driver_value_handlers php_driver_bigint_handlers;
+
+ static HashTable *
+ php_driver_bigint_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+@@ -409,7 +409,7 @@ php_driver_bigint_gc(
+
+ static HashTable *
+ php_driver_bigint_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object TSRMLS_DC
+ #else
+ zval *object TSRMLS_DC
+@@ -419,13 +419,11 @@ php_driver_bigint_properties(
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_BIGINT TSRMLS_CC);
+@@ -441,6 +439,9 @@ php_driver_bigint_properties(
+ static int
+ php_driver_bigint_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_numeric *bigint1 = NULL;
+ php_driver_numeric *bigint2 = NULL;
+
+@@ -467,20 +468,18 @@ php_driver_bigint_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_bigint_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -531,7 +530,11 @@ void php_driver_define_Bigint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_bigint_handlers.std.get_gc = php_driver_bigint_gc;
+ #endif
+- php_driver_bigint_handlers.std.compare = php_driver_bigint_compare;
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_bigint_handlers.std.compare = php_driver_bigint_compare;
++#else
++ php_driver_bigint_handlers.std.compare_objects = php_driver_bigint_compare;
++#endif
+ php_driver_bigint_handlers.std.cast_object = php_driver_bigint_cast;
+
+ php_driver_bigint_handlers.hash_value = php_driver_bigint_hash_value;
+diff --git a/ext/src/Blob.c b/ext/src/Blob.c
+index 3592e064..84acc337 100644
+--- a/ext/src/Blob.c
++++ b/ext/src/Blob.c
+@@ -114,12 +114,13 @@ static php_driver_value_handlers php_driver_blob_handlers;
+
+ static HashTable *
+ php_driver_blob_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -128,10 +129,10 @@ php_driver_blob_gc(
+
+ static HashTable *
+ php_driver_blob_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object TSRMLS_DC
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -140,13 +141,11 @@ php_driver_blob_properties(
+ php5to7_zval type;
+ php5to7_zval bytes;
+
+- php_driver_blob *self = PHP_DRIVER_GET_BLOB(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_blob *self = PHP5TO7_ZEND_OBJECT_GET(blob, object);
+ #else
+- object
++ php_driver_blob *self = PHP_DRIVER_GET_BLOB(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_BLOB TSRMLS_CC);
+@@ -164,6 +163,9 @@ php_driver_blob_properties(
+ static int
+ php_driver_blob_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_blob *blob1 = NULL;
+ php_driver_blob *blob2 = NULL;
+
+@@ -223,10 +225,10 @@ void php_driver_define_Blob(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_blob_handlers.std.get_gc = php_driver_blob_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_blob_handlers.std.compare = php_driver_blob_compare;
+ #else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_blob_handlers.std.compare = php_driver_blob_compare;
+ #else
+ php_driver_blob_handlers.std.compare_objects = php_driver_blob_compare;
+diff --git a/ext/src/Cluster/Builder.c b/ext/src/Cluster/Builder.c
+index 64ce56a5..d0daee51 100644
+--- a/ext/src/Cluster/Builder.c
++++ b/ext/src/Cluster/Builder.c
+@@ -1064,7 +1064,7 @@ static zend_object_handlers php_driver_cluster_builder_handlers;
+
+ static HashTable*
+ php_driver_cluster_builder_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+@@ -1079,7 +1079,7 @@ php_driver_cluster_builder_gc(
+
+ static HashTable*
+ php_driver_cluster_builder_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object TSRMLS_DC
+ #else
+ zval *object TSRMLS_DC
+@@ -1121,7 +1121,7 @@ php_driver_cluster_builder_properties(
+ php5to7_zval connectionHeartbeatInterval;
+
+ php_driver_cluster_builder *self = PHP_DRIVER_GET_CLUSTER_BUILDER(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ (zval*) object
+ #else
+ object
+@@ -1461,10 +1461,10 @@ void php_driver_define_ClusterBuilder(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_cluster_builder_handlers.get_gc = php_driver_cluster_builder_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_cluster_builder_handlers.compare = php_driver_cluster_builder_compare;
+ #else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_cluster_builder_handlers.compare = php_driver_cluster_builder_compare;
+ #else
+ php_driver_cluster_builder_handlers.compare_objects = php_driver_cluster_builder_compare;
+diff --git a/ext/src/Collection.c b/ext/src/Collection.c
+index 8b595b8e..1083bf07 100644
+--- a/ext/src/Collection.c
++++ b/ext/src/Collection.c
+@@ -283,6 +283,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_END_ARG_INFO()
+
++#if PHP_MAJOR_VERSION >= 8
++ZEND_BEGIN_ARG_INFO_EX(arginfo_values, 0, ZEND_RETURN_VALUE, 1)
++ ZEND_ARG_VARIADIC_INFO(0, value)
++ZEND_END_ARG_INFO()
++#endif
++
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_index, 0, ZEND_RETURN_VALUE, 1)
+ ZEND_ARG_INFO(0, index)
+ ZEND_END_ARG_INFO()
+@@ -294,7 +300,11 @@ static zend_function_entry php_driver_collection_methods[] = {
+ PHP_ME(Collection, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+ PHP_ME(Collection, type, arginfo_none, ZEND_ACC_PUBLIC)
+ PHP_ME(Collection, values, arginfo_none, ZEND_ACC_PUBLIC)
++#if PHP_MAJOR_VERSION >= 8
++ PHP_ME(Collection, add, arginfo_values, ZEND_ACC_PUBLIC)
++#else
+ PHP_ME(Collection, add, arginfo_value, ZEND_ACC_PUBLIC)
++#endif
+ PHP_ME(Collection, get, arginfo_index, ZEND_ACC_PUBLIC)
+ PHP_ME(Collection, find, arginfo_value, ZEND_ACC_PUBLIC)
+ /* Countable */
+@@ -313,7 +323,7 @@ static php_driver_value_handlers php_driver_collection_handlers;
+
+ static HashTable *
+ php_driver_collection_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+@@ -327,7 +337,7 @@ php_driver_collection_gc(
+
+ static HashTable *
+ php_driver_collection_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+@@ -336,13 +346,11 @@ php_driver_collection_properties(
+ {
+ php5to7_zval values;
+
+- php_driver_collection *self = PHP_DRIVER_GET_COLLECTION(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_collection *self = PHP5TO7_ZEND_OBJECT_GET(collection, object);
+ #else
+- object
++ php_driver_collection *self = PHP_DRIVER_GET_COLLECTION(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -361,6 +369,9 @@ php_driver_collection_properties(
+ static int
+ php_driver_collection_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ HashPosition pos1;
+ HashPosition pos2;
+ php5to7_zval *current1;
+@@ -460,14 +471,10 @@ void php_driver_define_Collection(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_collection_handlers.std.get_gc = php_driver_collection_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_collection_handlers.std.compare = php_driver_collection_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_collection_handlers.std.compare = php_driver_collection_compare;
+ #else
+ php_driver_collection_handlers.std.compare_objects = php_driver_collection_compare;
+-#endif
+ #endif
+ php_driver_collection_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_collection_ce->create_object = php_driver_collection_new;
+diff --git a/ext/src/Date.c b/ext/src/Date.c
+index 79d67883..8d4e654d 100644
+--- a/ext/src/Date.c
++++ b/ext/src/Date.c
+@@ -117,18 +117,19 @@ PHP_METHOD(Date, toDateTime)
+ PHP_METHOD(Date, fromDateTime)
+ {
+ php_driver_date *self;
+-#if PHP_VERSION_ID >= 80000
+- zend_object *zdatetime;
+-#else
+ zval *zdatetime;
+-#endif
+ php5to7_zval retval;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zdatetime) == FAILURE) {
+ return;
+ }
+
+- zend_call_method_with_0_params(PHP5TO7_ZVAL_MAYBE_ADDR_OF(zdatetime),
++ zend_call_method_with_0_params(
++#if PHP_MAJOR_VERSION >= 8
++ Z_OBJ_P(zdatetime),
++#else
++ PHP5TO7_ZVAL_MAYBE_ADDR_OF(zdatetime),
++#endif
+ php_date_get_date_ce(),
+ NULL,
+ "gettimestamp",
+@@ -193,7 +194,7 @@ static php_driver_value_handlers php_driver_date_handlers;
+
+ static HashTable *
+ php_driver_date_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+@@ -207,7 +208,7 @@ php_driver_date_gc(
+
+ static HashTable *
+ php_driver_date_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+@@ -217,13 +218,11 @@ php_driver_date_properties(
+ php5to7_zval type;
+ php5to7_zval seconds;
+
+- php_driver_date *self = PHP_DRIVER_GET_DATE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_date *self = PHP5TO7_ZEND_OBJECT_GET(date, object);
+ #else
+- object
++ php_driver_date *self = PHP_DRIVER_GET_DATE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_DATE TSRMLS_CC);
+@@ -239,6 +238,9 @@ php_driver_date_properties(
+ static int
+ php_driver_date_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_date *date1 = NULL;
+ php_driver_date *date2 = NULL;
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+@@ -289,14 +291,10 @@ void php_driver_define_Date(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_date_handlers.std.get_gc = php_driver_date_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_date_handlers.std.compare = php_driver_date_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_date_handlers.std.compare = php_driver_date_compare;
+ #else
+ php_driver_date_handlers.std.compare_objects = php_driver_date_compare;
+-#endif
+ #endif
+ php_driver_date_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_date_ce->create_object = php_driver_date_new;
+diff --git a/ext/src/Decimal.c b/ext/src/Decimal.c
+index 31565975..d2956ef1 100644
+--- a/ext/src/Decimal.c
++++ b/ext/src/Decimal.c
+@@ -513,12 +513,13 @@ static php_driver_value_handlers php_driver_decimal_handlers;
+
+ static HashTable*
+ php_driver_decimal_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -527,12 +528,12 @@ php_driver_decimal_gc(
+
+ static HashTable*
+ php_driver_decimal_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+ #endif
+- )
++)
+ {
+ char* string;
+ int string_len;
+@@ -540,13 +541,11 @@ php_driver_decimal_properties(
+ php5to7_zval value;
+ php5to7_zval scale;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_DECIMAL TSRMLS_CC);
+@@ -568,6 +567,9 @@ php_driver_decimal_properties(
+ static int
+ php_driver_decimal_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_numeric *decimal1 = NULL;
+ php_driver_numeric *decimal2 = NULL;
+
+@@ -595,20 +597,19 @@ php_driver_decimal_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_decimal_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC
++)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -663,14 +664,10 @@ void php_driver_define_Decimal(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_decimal_handlers.std.get_gc = php_driver_decimal_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_decimal_handlers.std.compare = php_driver_decimal_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_decimal_handlers.std.compare = php_driver_decimal_compare;
+ #else
+ php_driver_decimal_handlers.std.compare_objects = php_driver_decimal_compare;
+-#endif
+ #endif
+ php_driver_decimal_handlers.std.cast_object = php_driver_decimal_cast;
+
+diff --git a/ext/src/DefaultAggregate.c b/ext/src/DefaultAggregate.c
+index 09b9703a..4e7f4191 100644
+--- a/ext/src/DefaultAggregate.c
++++ b/ext/src/DefaultAggregate.c
+@@ -215,12 +215,13 @@ static zend_object_handlers php_driver_default_aggregate_handlers;
+
+ static HashTable *
+ php_driver_type_default_aggregate_gc(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object,
+ #else
+ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -229,12 +230,12 @@ php_driver_type_default_aggregate_gc(
+
+ static HashTable *
+ php_driver_default_aggregate_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+ #endif
+- )
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -244,6 +245,9 @@ php_driver_default_aggregate_properties(
+ static int
+ php_driver_default_aggregate_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -310,14 +314,10 @@ void php_driver_define_DefaultAggregate(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_aggregate_handlers.get_gc = php_driver_type_default_aggregate_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_default_aggregate_handlers.compare = php_driver_default_aggregate_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_aggregate_handlers.compare = php_driver_default_aggregate_compare;
+ #else
+ php_driver_default_aggregate_handlers.compare_objects = php_driver_default_aggregate_compare;
+-#endif
+ #endif
+ php_driver_default_aggregate_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultCluster.c b/ext/src/DefaultCluster.c
+index 0b9fccb7..79afc1ea 100644
+--- a/ext/src/DefaultCluster.c
++++ b/ext/src/DefaultCluster.c
+@@ -223,12 +223,12 @@ static zend_object_handlers php_driver_default_cluster_handlers;
+
+ static HashTable *
+ php_driver_default_cluster_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+ #endif
+- )
++)
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+@@ -238,6 +238,9 @@ php_driver_default_cluster_properties(
+ static int
+ php_driver_default_cluster_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -292,13 +295,9 @@ void php_driver_define_DefaultCluster(TSRMLS_D)
+
+ memcpy(&php_driver_default_cluster_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_cluster_handlers.get_properties = php_driver_default_cluster_properties;
+-#if PHP_VERSION_ID >= 80000
+- php_driver_default_cluster_handlers.compare = php_driver_default_cluster_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_cluster_handlers.compare = php_driver_default_cluster_compare;
+ #else
+ php_driver_default_cluster_handlers.compare_objects = php_driver_default_cluster_compare;
+ #endif
+-#endif
+ }
+diff --git a/ext/src/DefaultColumn.c b/ext/src/DefaultColumn.c
+index f36645ef..0149b633 100644
+--- a/ext/src/DefaultColumn.c
++++ b/ext/src/DefaultColumn.c
+@@ -222,12 +222,13 @@ static zend_object_handlers php_driver_default_column_handlers;
+
+ static HashTable *
+ php_driver_type_default_column_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -236,10 +237,10 @@ php_driver_type_default_column_gc(
+
+ static HashTable *
+ php_driver_default_column_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -251,6 +252,9 @@ php_driver_default_column_properties(
+ static int
+ php_driver_default_column_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -306,14 +310,10 @@ void php_driver_define_DefaultColumn(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_column_handlers.get_gc = php_driver_type_default_column_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_default_column_handlers.compare = php_driver_default_column_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_column_handlers.compare = php_driver_default_column_compare;
+ #else
+ php_driver_default_column_handlers.compare_objects = php_driver_default_column_compare;
+-#endif
+ #endif
+ php_driver_default_column_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultFunction.c b/ext/src/DefaultFunction.c
+index 5ef3bcc6..1caf1cc8 100644
+--- a/ext/src/DefaultFunction.c
++++ b/ext/src/DefaultFunction.c
+@@ -208,12 +208,13 @@ static zend_object_handlers php_driver_default_function_handlers;
+
+ static HashTable *
+ php_driver_type_default_function_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -222,10 +223,10 @@ php_driver_type_default_function_gc(
+
+ static HashTable *
+ php_driver_default_function_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -237,6 +238,9 @@ php_driver_default_function_properties(
+ static int
+ php_driver_default_function_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -299,14 +303,10 @@ void php_driver_define_DefaultFunction(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_function_handlers.get_gc = php_driver_type_default_function_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
+- php_driver_default_function_handlers.compare = php_driver_default_function_compare;
+-#else
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_function_handlers.compare = php_driver_default_function_compare;
+ #else
+ php_driver_default_function_handlers.compare_objects = php_driver_default_function_compare;
+-#endif
+ #endif
+ php_driver_default_function_handlers.clone_obj = NULL;
+ }
+diff --git a/ext/src/DefaultIndex.c b/ext/src/DefaultIndex.c
+index bb67ab6b..01ddd0cb 100644
+--- a/ext/src/DefaultIndex.c
++++ b/ext/src/DefaultIndex.c
+@@ -236,12 +236,13 @@ static zend_object_handlers php_driver_default_index_handlers;
+
+ static HashTable *
+ php_driver_type_default_index_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -250,10 +251,10 @@ php_driver_type_default_index_gc(
+
+ static HashTable *
+ php_driver_default_index_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -265,6 +266,9 @@ php_driver_default_index_properties(
+ static int
+ php_driver_default_index_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -323,7 +327,7 @@ void php_driver_define_DefaultIndex(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_index_handlers.get_gc = php_driver_type_default_index_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_index_handlers.compare = php_driver_default_index_compare;
+ #else
+ php_driver_default_index_handlers.compare_objects = php_driver_default_index_compare;
+diff --git a/ext/src/DefaultKeyspace.c b/ext/src/DefaultKeyspace.c
+index 4d549e2c..7e629cc0 100644
+--- a/ext/src/DefaultKeyspace.c
++++ b/ext/src/DefaultKeyspace.c
+@@ -517,12 +517,13 @@ static zend_object_handlers php_driver_default_keyspace_handlers;
+
+ static HashTable *
+ php_driver_type_default_keyspace_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -531,10 +532,10 @@ php_driver_type_default_keyspace_gc(
+
+ static HashTable *
+ php_driver_default_keyspace_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -546,6 +547,9 @@ php_driver_default_keyspace_properties(
+ static int
+ php_driver_default_keyspace_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -594,7 +598,7 @@ void php_driver_define_DefaultKeyspace(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_keyspace_handlers.get_gc = php_driver_type_default_keyspace_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_keyspace_handlers.compare = php_driver_default_keyspace_compare;
+ #else
+ php_driver_default_keyspace_handlers.compare_objects = php_driver_default_keyspace_compare;
+diff --git a/ext/src/DefaultMaterializedView.c b/ext/src/DefaultMaterializedView.c
+index 4d1df7eb..e87206a5 100644
+--- a/ext/src/DefaultMaterializedView.c
++++ b/ext/src/DefaultMaterializedView.c
+@@ -579,12 +579,13 @@ static zend_object_handlers php_driver_default_materialized_view_handlers;
+
+ static HashTable *
+ php_driver_type_default_materialized_view_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -593,10 +594,10 @@ php_driver_type_default_materialized_view_gc(
+
+ static HashTable *
+ php_driver_default_materialized_view_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -608,6 +609,9 @@ php_driver_default_materialized_view_properties(
+ static int
+ php_driver_default_materialized_view_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -671,7 +675,7 @@ void php_driver_define_DefaultMaterializedView(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_materialized_view_handlers.get_gc = php_driver_type_default_materialized_view_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_materialized_view_handlers.compare = php_driver_default_materialized_view_compare;
+ #else
+ php_driver_default_materialized_view_handlers.compare_objects = php_driver_default_materialized_view_compare;
+diff --git a/ext/src/DefaultSchema.c b/ext/src/DefaultSchema.c
+index aa1d5db8..85d5ad11 100644
+--- a/ext/src/DefaultSchema.c
++++ b/ext/src/DefaultSchema.c
+@@ -114,10 +114,10 @@ static zend_object_handlers php_driver_default_schema_handlers;
+
+ static HashTable *
+ php_driver_default_schema_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -129,6 +129,9 @@ php_driver_default_schema_properties(
+ static int
+ php_driver_default_schema_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -172,7 +175,7 @@ void php_driver_define_DefaultSchema(TSRMLS_D)
+
+ memcpy(&php_driver_default_schema_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_schema_handlers.get_properties = php_driver_default_schema_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_schema_handlers.compare = php_driver_default_schema_compare;
+ #else
+ php_driver_default_schema_handlers.compare_objects = php_driver_default_schema_compare;
+diff --git a/ext/src/DefaultSession.c b/ext/src/DefaultSession.c
+index 8aa701cf..ee7bb0c3 100644
+--- a/ext/src/DefaultSession.c
++++ b/ext/src/DefaultSession.c
+@@ -1130,10 +1130,10 @@ static zend_object_handlers php_driver_default_session_handlers;
+
+ static HashTable *
+ php_driver_default_session_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -1145,6 +1145,9 @@ php_driver_default_session_properties(
+ static int
+ php_driver_default_session_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -1192,7 +1195,7 @@ void php_driver_define_DefaultSession(TSRMLS_D)
+
+ memcpy(&php_driver_default_session_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_default_session_handlers.get_properties = php_driver_default_session_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_session_handlers.compare = php_driver_default_session_compare;
+ #else
+ php_driver_default_session_handlers.compare_objects = php_driver_default_session_compare;
+diff --git a/ext/src/DefaultTable.c b/ext/src/DefaultTable.c
+index c033f56b..6b4c2c4b 100644
+--- a/ext/src/DefaultTable.c
++++ b/ext/src/DefaultTable.c
+@@ -687,12 +687,13 @@ static zend_object_handlers php_driver_default_table_handlers;
+
+ static HashTable *
+ php_driver_type_default_table_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -701,10 +702,10 @@ php_driver_type_default_table_gc(
+
+ static HashTable *
+ php_driver_default_table_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -716,6 +717,9 @@ php_driver_default_table_properties(
+ static int
+ php_driver_default_table_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -778,7 +782,7 @@ void php_driver_define_DefaultTable(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_default_table_handlers.get_gc = php_driver_type_default_table_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_default_table_handlers.compare = php_driver_default_table_compare;
+ #else
+ php_driver_default_table_handlers.compare_objects = php_driver_default_table_compare;
+diff --git a/ext/src/Duration.c b/ext/src/Duration.c
+index b24b3997..53ebb43c 100644
+--- a/ext/src/Duration.c
++++ b/ext/src/Duration.c
+@@ -227,21 +227,20 @@ static php_driver_value_handlers php_driver_duration_handlers;
+
+ static HashTable *
+ php_driver_duration_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+- php_driver_duration *self = PHP_DRIVER_GET_DURATION(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_duration *self = PHP5TO7_ZEND_OBJECT_GET(duration, object);
+ #else
+- object
++ php_driver_duration *self = PHP_DRIVER_GET_DURATION(object);
+ #endif
+- );
+
+ php5to7_zval wrapped_months, wrapped_days, wrapped_nanos;
+ PHP5TO7_ZVAL_MAYBE_MAKE(wrapped_months);
+@@ -260,6 +259,9 @@ php_driver_duration_properties(
+ static int
+ php_driver_duration_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_duration *left, *right;
+
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+@@ -334,7 +336,7 @@ void php_driver_define_Duration(TSRMLS_D)
+
+ memcpy(&php_driver_duration_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_duration_handlers.std.get_properties = php_driver_duration_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_duration_handlers.std.compare = php_driver_duration_compare;
+ #else
+ php_driver_duration_handlers.std.compare_objects = php_driver_duration_compare;
+diff --git a/ext/src/ExecutionOptions.c b/ext/src/ExecutionOptions.c
+index 13240f0d..a243b8d2 100644
+--- a/ext/src/ExecutionOptions.c
++++ b/ext/src/ExecutionOptions.c
+@@ -249,10 +249,10 @@ static zend_object_handlers php_driver_execution_options_handlers;
+
+ static HashTable *
+ php_driver_execution_options_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -264,6 +264,9 @@ php_driver_execution_options_properties(
+ static int
+ php_driver_execution_options_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -309,7 +312,7 @@ void php_driver_define_ExecutionOptions(TSRMLS_D)
+
+ memcpy(&php_driver_execution_options_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_execution_options_handlers.get_properties = php_driver_execution_options_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_execution_options_handlers.compare = php_driver_execution_options_compare;
+ #else
+ php_driver_execution_options_handlers.compare_objects = php_driver_execution_options_compare;
+diff --git a/ext/src/Float.c b/ext/src/Float.c
+index f1b55261..cc04fb35 100644
+--- a/ext/src/Float.c
++++ b/ext/src/Float.c
+@@ -373,12 +373,13 @@ static php_driver_value_handlers php_driver_float_handlers;
+
+ static HashTable *
+ php_driver_float_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -387,23 +388,21 @@ php_driver_float_gc(
+
+ static HashTable *
+ php_driver_float_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_FLOAT TSRMLS_CC);
+@@ -427,6 +426,9 @@ float_to_bits(cass_float_t value) {
+ static int
+ php_driver_float_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ cass_int32_t bits1, bits2;
+ php_driver_numeric *flt1 = NULL;
+ php_driver_numeric *flt2 = NULL;
+@@ -456,20 +458,19 @@ php_driver_float_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_float_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC
++)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -520,7 +521,7 @@ void php_driver_define_Float(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_float_handlers.std.get_gc = php_driver_float_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_float_handlers.std.compare = php_driver_float_compare;
+ #else
+ php_driver_float_handlers.std.compare_objects = php_driver_float_compare;
+diff --git a/ext/src/FutureClose.c b/ext/src/FutureClose.c
+index d392b97a..0954db51 100644
+--- a/ext/src/FutureClose.c
++++ b/ext/src/FutureClose.c
+@@ -50,10 +50,10 @@ static zend_object_handlers php_driver_future_close_handlers;
+
+ static HashTable *
+ php_driver_future_close_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -65,6 +65,9 @@ php_driver_future_close_properties(
+ static int
+ php_driver_future_close_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -107,7 +110,7 @@ void php_driver_define_FutureClose(TSRMLS_D)
+
+ memcpy(&php_driver_future_close_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_close_handlers.get_properties = php_driver_future_close_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_future_close_handlers.compare = php_driver_future_close_compare;
+ #else
+ php_driver_future_close_handlers.compare_objects = php_driver_future_close_compare;
+diff --git a/ext/src/FuturePreparedStatement.c b/ext/src/FuturePreparedStatement.c
+index 0337dd6d..374b58a6 100644
+--- a/ext/src/FuturePreparedStatement.c
++++ b/ext/src/FuturePreparedStatement.c
+@@ -64,10 +64,10 @@ static zend_object_handlers php_driver_future_prepared_statement_handlers;
+
+ static HashTable *
+ php_driver_future_prepared_statement_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -79,6 +79,9 @@ php_driver_future_prepared_statement_properties(
+ static int
+ php_driver_future_prepared_statement_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -126,7 +129,7 @@ void php_driver_define_FuturePreparedStatement(TSRMLS_D)
+
+ memcpy(&php_driver_future_prepared_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_prepared_statement_handlers.get_properties = php_driver_future_prepared_statement_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_future_prepared_statement_handlers.compare = php_driver_future_prepared_statement_compare;
+ #else
+ php_driver_future_prepared_statement_handlers.compare_objects = php_driver_future_prepared_statement_compare;
+diff --git a/ext/src/FutureRows.c b/ext/src/FutureRows.c
+index 427ad35f..0811ac14 100644
+--- a/ext/src/FutureRows.c
++++ b/ext/src/FutureRows.c
+@@ -104,10 +104,10 @@ static zend_object_handlers php_driver_future_rows_handlers;
+
+ static HashTable *
+ php_driver_future_rows_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -119,6 +119,9 @@ php_driver_future_rows_properties(
+ static int
+ php_driver_future_rows_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -171,7 +174,7 @@ void php_driver_define_FutureRows(TSRMLS_D)
+
+ memcpy(&php_driver_future_rows_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_rows_handlers.get_properties = php_driver_future_rows_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_future_rows_handlers.compare = php_driver_future_rows_compare;
+ #else
+ php_driver_future_rows_handlers.compare_objects = php_driver_future_rows_compare;
+diff --git a/ext/src/FutureSession.c b/ext/src/FutureSession.c
+index 9452c1aa..1ab85a1b 100644
+--- a/ext/src/FutureSession.c
++++ b/ext/src/FutureSession.c
+@@ -96,10 +96,10 @@ static zend_object_handlers php_driver_future_session_handlers;
+
+ static HashTable *
+ php_driver_future_session_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -111,6 +111,9 @@ php_driver_future_session_properties(
+ static int
+ php_driver_future_session_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -172,7 +175,7 @@ void php_driver_define_FutureSession(TSRMLS_D)
+
+ memcpy(&php_driver_future_session_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_session_handlers.get_properties = php_driver_future_session_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_future_session_handlers.compare = php_driver_future_session_compare;
+ #else
+ php_driver_future_session_handlers.compare_objects = php_driver_future_session_compare;
+diff --git a/ext/src/FutureValue.c b/ext/src/FutureValue.c
+index 6c5f50ea..1034c19a 100644
+--- a/ext/src/FutureValue.c
++++ b/ext/src/FutureValue.c
+@@ -47,10 +47,10 @@ static zend_object_handlers php_driver_future_value_handlers;
+
+ static HashTable *
+ php_driver_future_value_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -62,6 +62,9 @@ php_driver_future_value_properties(
+ static int
+ php_driver_future_value_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -103,7 +106,7 @@ void php_driver_define_FutureValue(TSRMLS_D)
+
+ memcpy(&php_driver_future_value_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_future_value_handlers.get_properties = php_driver_future_value_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_future_value_handlers.compare = php_driver_future_value_compare;
+ #else
+ php_driver_future_value_handlers.compare_objects = php_driver_future_value_compare;
+diff --git a/ext/src/Inet.c b/ext/src/Inet.c
+index fd5d8848..b2fd4e57 100644
+--- a/ext/src/Inet.c
++++ b/ext/src/Inet.c
+@@ -102,12 +102,13 @@ static php_driver_value_handlers php_driver_inet_handlers;
+
+ static HashTable *
+ php_driver_inet_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -116,10 +117,10 @@ php_driver_inet_gc(
+
+ static HashTable *
+ php_driver_inet_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -127,13 +128,11 @@ php_driver_inet_properties(
+ php5to7_zval type;
+ php5to7_zval address;
+
+- php_driver_inet *self = PHP_DRIVER_GET_INET(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_inet *self = PHP5TO7_ZEND_OBJECT_GET(inet, object);
+ #else
+- object
++ php_driver_inet *self = PHP_DRIVER_GET_INET(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_INET TSRMLS_CC);
+@@ -151,6 +150,9 @@ php_driver_inet_properties(
+ static int
+ php_driver_inet_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_inet *inet1 = NULL;
+ php_driver_inet *inet2 = NULL;
+
+@@ -204,7 +206,7 @@ void php_driver_define_Inet(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_inet_handlers.std.get_gc = php_driver_inet_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_inet_handlers.std.compare = php_driver_inet_compare;
+ #else
+ php_driver_inet_handlers.std.compare_objects = php_driver_inet_compare;
+diff --git a/ext/src/Map.c b/ext/src/Map.c
+index d58a759d..b453e131 100644
+--- a/ext/src/Map.c
++++ b/ext/src/Map.c
+@@ -455,12 +455,13 @@ static php_driver_value_handlers php_driver_map_handlers;
+
+ static HashTable *
+ php_driver_map_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -469,23 +470,21 @@ php_driver_map_gc(
+
+ static HashTable *
+ php_driver_map_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval keys;
+ php5to7_zval values;
+
+- php_driver_map *self = PHP_DRIVER_GET_MAP(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_map *self = PHP5TO7_ZEND_OBJECT_GET(map, object);
+ #else
+- object
++ php_driver_map *self = PHP_DRIVER_GET_MAP(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+
+@@ -512,6 +511,9 @@ php_driver_map_properties(
+ static int
+ php_driver_map_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_map_entry *curr, *temp;
+ php_driver_map *map1;
+ php_driver_map *map2;
+@@ -615,7 +617,7 @@ void php_driver_define_Map(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_map_handlers.std.get_gc = php_driver_map_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_map_handlers.std.compare = php_driver_map_compare;
+ #else
+ php_driver_map_handlers.std.compare_objects = php_driver_map_compare;
+diff --git a/ext/src/PreparedStatement.c b/ext/src/PreparedStatement.c
+index d71e1937..6bd04412 100644
+--- a/ext/src/PreparedStatement.c
++++ b/ext/src/PreparedStatement.c
+@@ -35,10 +35,10 @@ static zend_object_handlers php_driver_prepared_statement_handlers;
+
+ static HashTable *
+ php_driver_prepared_statement_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -50,6 +50,9 @@ php_driver_prepared_statement_properties(
+ static int
+ php_driver_prepared_statement_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -92,7 +95,7 @@ void php_driver_define_PreparedStatement(TSRMLS_D)
+
+ memcpy(&php_driver_prepared_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_prepared_statement_handlers.get_properties = php_driver_prepared_statement_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_prepared_statement_handlers.compare = php_driver_prepared_statement_compare;
+ #else
+ php_driver_prepared_statement_handlers.compare_objects = php_driver_prepared_statement_compare;
+diff --git a/ext/src/Rows.c b/ext/src/Rows.c
+index 7ed21bd1..234af827 100644
+--- a/ext/src/Rows.c
++++ b/ext/src/Rows.c
+@@ -385,9 +385,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_set, 0, ZEND_RETURN_VALUE, 2)
+ ZEND_ARG_INFO(0, value)
+ ZEND_END_ARG_INFO()
+
++#if PHP_MAJOR_VERSION >= 8
++ZEND_BEGIN_ARG_INFO_EX(arginfo_timeout, 0, ZEND_RETURN_VALUE, 0)
++ ZEND_ARG_INFO(0, timeout)
++ZEND_END_ARG_INFO()
++#else
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_timeout, 0, ZEND_RETURN_VALUE, 1)
+ ZEND_ARG_INFO(0, timeout)
+ ZEND_END_ARG_INFO()
++#endif
+
+ static zend_function_entry php_driver_rows_methods[] = {
+ PHP_ME(Rows, __construct, arginfo_none, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+@@ -413,10 +419,10 @@ static zend_object_handlers php_driver_rows_handlers;
+
+ static HashTable *
+ php_driver_rows_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -428,6 +434,9 @@ php_driver_rows_properties(
+ static int
+ php_driver_rows_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -481,7 +490,7 @@ void php_driver_define_Rows(TSRMLS_D)
+
+ memcpy(&php_driver_rows_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_rows_handlers.get_properties = php_driver_rows_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_rows_handlers.compare = php_driver_rows_compare;
+ #else
+ php_driver_rows_handlers.compare_objects = php_driver_rows_compare;
+diff --git a/ext/src/SSLOptions.c b/ext/src/SSLOptions.c
+index 0ce9467e..1be656ae 100644
+--- a/ext/src/SSLOptions.c
++++ b/ext/src/SSLOptions.c
+@@ -27,10 +27,10 @@ static zend_object_handlers php_driver_ssl_handlers;
+
+ static HashTable *
+ php_driver_ssl_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -42,6 +42,9 @@ php_driver_ssl_properties(
+ static int
+ php_driver_ssl_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -81,7 +84,7 @@ void php_driver_define_SSLOptions(TSRMLS_D)
+
+ memcpy(&php_driver_ssl_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_ssl_handlers.get_properties = php_driver_ssl_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_ssl_handlers.compare = php_driver_ssl_compare;
+ #else
+ php_driver_ssl_handlers.compare_objects = php_driver_ssl_compare;
+diff --git a/ext/src/SSLOptions/Builder.c b/ext/src/SSLOptions/Builder.c
+index 44a76a9e..2a9686d1 100644
+--- a/ext/src/SSLOptions/Builder.c
++++ b/ext/src/SSLOptions/Builder.c
+@@ -274,7 +274,7 @@ static zend_object_handlers php_driver_ssl_builder_handlers;
+
+ static HashTable *
+ php_driver_ssl_builder_properties(
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ zend_object *object
+ #else
+ zval *object TSRMLS_DC
+@@ -349,7 +349,7 @@ void php_driver_define_SSLOptionsBuilder(TSRMLS_D)
+
+ memcpy(&php_driver_ssl_builder_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_ssl_builder_handlers.get_properties = php_driver_ssl_builder_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_ssl_builder_handlers.compare = php_driver_ssl_builder_compare;
+ #else
+ php_driver_ssl_builder_handlers.compare_objects = php_driver_ssl_builder_compare;
+diff --git a/ext/src/Set.c b/ext/src/Set.c
+index f018a0c3..5e866d21 100644
+--- a/ext/src/Set.c
++++ b/ext/src/Set.c
+@@ -300,12 +300,13 @@ static php_driver_value_handlers php_driver_set_handlers;
+
+ static HashTable *
+ php_driver_set_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -314,22 +315,20 @@ php_driver_set_gc(
+
+ static HashTable *
+ php_driver_set_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval values;
+
+- php_driver_set *self = PHP_DRIVER_GET_SET(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_set *self = PHP5TO7_ZEND_OBJECT_GET(set, object);
+ #else
+- object
++ php_driver_set *self = PHP_DRIVER_GET_SET(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+
+@@ -350,6 +349,9 @@ php_driver_set_properties(
+ static int
+ php_driver_set_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_set_entry *curr, *temp;
+ php_driver_set *set1;
+ php_driver_set *set2;
+@@ -447,7 +449,7 @@ void php_driver_define_Set(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_set_handlers.std.get_gc = php_driver_set_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_set_handlers.std.compare = php_driver_set_compare;
+ #else
+ php_driver_set_handlers.std.compare_objects = php_driver_set_compare;
+diff --git a/ext/src/SimpleStatement.c b/ext/src/SimpleStatement.c
+index 6aa5cf8e..887f3af7 100644
+--- a/ext/src/SimpleStatement.c
++++ b/ext/src/SimpleStatement.c
+@@ -50,10 +50,10 @@ static zend_object_handlers php_driver_simple_statement_handlers;
+
+ static HashTable *
+ php_driver_simple_statement_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -65,6 +65,9 @@ php_driver_simple_statement_properties(
+ static int
+ php_driver_simple_statement_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+ return 1; /* different classes */
+
+@@ -109,7 +112,7 @@ void php_driver_define_SimpleStatement(TSRMLS_D)
+
+ memcpy(&php_driver_simple_statement_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_driver_simple_statement_handlers.get_properties = php_driver_simple_statement_properties;
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_simple_statement_handlers.compare = php_driver_simple_statement_compare;
+ #else
+ php_driver_simple_statement_handlers.compare_objects = php_driver_simple_statement_compare;
+diff --git a/ext/src/Smallint.c b/ext/src/Smallint.c
+index 5683af98..3b86ebac 100644
+--- a/ext/src/Smallint.c
++++ b/ext/src/Smallint.c
+@@ -427,12 +427,13 @@ static php_driver_value_handlers php_driver_smallint_handlers;
+
+ static HashTable *
+ php_driver_smallint_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -441,23 +442,21 @@ php_driver_smallint_gc(
+
+ static HashTable *
+ php_driver_smallint_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_SMALL_INT TSRMLS_CC);
+@@ -473,6 +472,9 @@ php_driver_smallint_properties(
+ static int
+ php_driver_smallint_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_numeric *smallint1 = NULL;
+ php_driver_numeric *smallint2 = NULL;
+
+@@ -499,20 +501,19 @@ php_driver_smallint_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_smallint_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC
++)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -563,7 +564,7 @@ void php_driver_define_Smallint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_smallint_handlers.std.get_gc = php_driver_smallint_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_smallint_handlers.std.compare = php_driver_smallint_compare;
+ #else
+ php_driver_smallint_handlers.std.compare_objects = php_driver_smallint_compare;
+diff --git a/ext/src/Time.c b/ext/src/Time.c
+index b364f833..89f6b022 100644
+--- a/ext/src/Time.c
++++ b/ext/src/Time.c
+@@ -151,18 +151,19 @@ PHP_METHOD(Time, seconds)
+ PHP_METHOD(Time, fromDateTime)
+ {
+ php_driver_time *self;
+-#if PHP_VERSION_ID >= 80000
+- zend_object *zdatetime;
+-#else
+ zval *zdatetime;
+-#endif
+ php5to7_zval retval;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zdatetime) == FAILURE) {
+ return;
+ }
+
+- zend_call_method_with_0_params(PHP5TO7_ZVAL_MAYBE_ADDR_OF(zdatetime),
++ zend_call_method_with_0_params(
++#if PHP_MAJOR_VERSION >= 8
++ Z_OBJ_P(zdatetime),
++#else
++ PHP5TO7_ZVAL_MAYBE_ADDR_OF(zdatetime),
++#endif
+ php_date_get_date_ce(),
+ NULL,
+ "gettimestamp",
+@@ -217,12 +218,13 @@ static php_driver_value_handlers php_driver_time_handlers;
+
+ static HashTable *
+ php_driver_time_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -231,23 +233,21 @@ php_driver_time_gc(
+
+ static HashTable *
+ php_driver_time_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval type;
+ php5to7_zval nanoseconds;
+
+- php_driver_time *self = PHP_DRIVER_GET_TIME(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_time *self = PHP5TO7_ZEND_OBJECT_GET(time, object);
+ #else
+- object
++ php_driver_time *self = PHP_DRIVER_GET_TIME(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TIME TSRMLS_CC);
+@@ -263,6 +263,9 @@ php_driver_time_properties(
+ static int
+ php_driver_time_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_time *time1 = NULL;
+ php_driver_time *time2 = NULL;
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+@@ -313,7 +316,7 @@ void php_driver_define_Time(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_time_handlers.std.get_gc = php_driver_time_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_time_handlers.std.compare = php_driver_time_compare;
+ #else
+ php_driver_time_handlers.std.compare_objects = php_driver_time_compare;
+diff --git a/ext/src/Timestamp.c b/ext/src/Timestamp.c
+index 5098ac8e..bb4cfef4 100644
+--- a/ext/src/Timestamp.c
++++ b/ext/src/Timestamp.c
+@@ -187,12 +187,13 @@ static php_driver_value_handlers php_driver_timestamp_handlers;
+
+ static HashTable *
+ php_driver_timestamp_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -201,10 +202,10 @@ php_driver_timestamp_gc(
+
+ static HashTable *
+ php_driver_timestamp_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -212,13 +213,11 @@ php_driver_timestamp_properties(
+ php5to7_zval seconds;
+ php5to7_zval microseconds;
+
+- php_driver_timestamp *self = PHP_DRIVER_GET_TIMESTAMP(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_timestamp *self = PHP5TO7_ZEND_OBJECT_GET(timestamp, object);
+ #else
+- object
++ php_driver_timestamp *self = PHP_DRIVER_GET_TIMESTAMP(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ long sec = (long) (self->timestamp / 1000);
+@@ -241,6 +240,9 @@ php_driver_timestamp_properties(
+ static int
+ php_driver_timestamp_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_timestamp *timestamp1 = NULL;
+ php_driver_timestamp *timestamp2 = NULL;
+ if (Z_OBJCE_P(obj1) != Z_OBJCE_P(obj2))
+@@ -289,7 +291,7 @@ void php_driver_define_Timestamp(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_timestamp_handlers.std.get_gc = php_driver_timestamp_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_timestamp_handlers.std.compare = php_driver_timestamp_compare;
+ #else
+ php_driver_timestamp_handlers.std.compare_objects = php_driver_timestamp_compare;
+diff --git a/ext/src/Timeuuid.c b/ext/src/Timeuuid.c
+index c94f753f..37501095 100644
+--- a/ext/src/Timeuuid.c
++++ b/ext/src/Timeuuid.c
+@@ -184,12 +184,13 @@ static php_driver_value_handlers php_driver_timeuuid_handlers;
+
+ static HashTable *
+ php_driver_timeuuid_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -198,10 +199,10 @@ php_driver_timeuuid_gc(
+
+ static HashTable *
+ php_driver_timeuuid_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -210,13 +211,11 @@ php_driver_timeuuid_properties(
+ php5to7_zval uuid;
+ php5to7_zval version;
+
+- php_driver_uuid *self = PHP_DRIVER_GET_UUID(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_uuid *self = PHP5TO7_ZEND_OBJECT_GET(uuid, object);
+ #else
+- object
++ php_driver_uuid *self = PHP_DRIVER_GET_UUID(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TIMEUUID TSRMLS_CC);
+@@ -238,6 +237,9 @@ php_driver_timeuuid_properties(
+ static int
+ php_driver_timeuuid_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_uuid *uuid1 = NULL;
+ php_driver_uuid *uuid2 = NULL;
+
+@@ -294,7 +296,7 @@ php_driver_define_Timeuuid(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_timeuuid_handlers.std.get_gc = php_driver_timeuuid_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_timeuuid_handlers.std.compare = php_driver_timeuuid_compare;
+ #else
+ php_driver_timeuuid_handlers.std.compare_objects = php_driver_timeuuid_compare;
+diff --git a/ext/src/Tinyint.c b/ext/src/Tinyint.c
+index af6dcca4..cafd1dd6 100644
+--- a/ext/src/Tinyint.c
++++ b/ext/src/Tinyint.c
+@@ -426,12 +426,13 @@ static php_driver_value_handlers php_driver_tinyint_handlers;
+
+ static HashTable *
+ php_driver_tinyint_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -440,23 +441,21 @@ php_driver_tinyint_gc(
+
+ static HashTable *
+ php_driver_tinyint_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ type = php_driver_type_scalar(CASS_VALUE_TYPE_TINY_INT TSRMLS_CC);
+@@ -472,6 +471,9 @@ php_driver_tinyint_properties(
+ static int
+ php_driver_tinyint_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_numeric *tinyint1 = NULL;
+ php_driver_numeric *tinyint2 = NULL;
+
+@@ -498,20 +500,19 @@ php_driver_tinyint_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_tinyint_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC
++)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -562,7 +563,7 @@ void php_driver_define_Tinyint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_tinyint_handlers.std.get_gc = php_driver_tinyint_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_tinyint_handlers.std.compare = php_driver_tinyint_compare;
+ #else
+ php_driver_tinyint_handlers.std.compare_objects = php_driver_tinyint_compare;
+diff --git a/ext/src/Tuple.c b/ext/src/Tuple.c
+index abc5f7a1..815dba98 100644
+--- a/ext/src/Tuple.c
++++ b/ext/src/Tuple.c
+@@ -271,11 +271,23 @@ ZEND_END_ARG_INFO()
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
++#if PHP_MAJOR_VERSION >= 8
++ZEND_BEGIN_ARG_INFO_EX(arginfo_index_value, 0, ZEND_RETURN_VALUE, 1)
++ ZEND_ARG_INFO(0, index)
++ ZEND_ARG_INFO(0, value)
++ZEND_END_ARG_INFO()
++#endif
++
++
+ static zend_function_entry php_driver_tuple_methods[] = {
+ PHP_ME(Tuple, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+ PHP_ME(Tuple, type, arginfo_none, ZEND_ACC_PUBLIC)
+ PHP_ME(Tuple, values, arginfo_none, ZEND_ACC_PUBLIC)
++#if PHP_MAJOR_VERSION >= 8
++ PHP_ME(Tuple, set, arginfo_index_value, ZEND_ACC_PUBLIC)
++#else
+ PHP_ME(Tuple, set, arginfo_value, ZEND_ACC_PUBLIC)
++#endif
+ PHP_ME(Tuple, get, arginfo_index, ZEND_ACC_PUBLIC)
+ /* Countable */
+ PHP_ME(Tuple, count, arginfo_none, ZEND_ACC_PUBLIC)
+@@ -292,12 +304,13 @@ static php_driver_value_handlers php_driver_tuple_handlers;
+
+ static HashTable *
+ php_driver_tuple_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -306,22 +319,20 @@ php_driver_tuple_gc(
+
+ static HashTable *
+ php_driver_tuple_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval values;
+
+- php_driver_tuple *self = PHP_DRIVER_GET_TUPLE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_tuple *self = PHP5TO7_ZEND_OBJECT_GET(tuple, object);
+ #else
+- object
++ php_driver_tuple *self = PHP_DRIVER_GET_TUPLE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -340,6 +351,9 @@ php_driver_tuple_properties(
+ static int
+ php_driver_tuple_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ HashPosition pos1;
+ HashPosition pos2;
+ php5to7_zval *current1;
+@@ -444,7 +458,7 @@ void php_driver_define_Tuple(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_tuple_handlers.std.get_gc = php_driver_tuple_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_tuple_handlers.std.compare = php_driver_tuple_compare;
+ #else
+ php_driver_tuple_handlers.std.compare_objects = php_driver_tuple_compare;
+diff --git a/ext/src/Type.c b/ext/src/Type.c
+index a68aeabf..67720bf1 100644
+--- a/ext/src/Type.c
++++ b/ext/src/Type.c
+@@ -197,7 +197,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_types, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, types)
++#else
+ ZEND_ARG_INFO(0, types)
++#endif
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_type, 0, ZEND_RETURN_VALUE, 1)
+diff --git a/ext/src/Type/Collection.c b/ext/src/Type/Collection.c
+index 7e7500c1..6c36c6f9 100644
+--- a/ext/src/Type/Collection.c
++++ b/ext/src/Type/Collection.c
+@@ -113,7 +113,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, value)
++#else
+ ZEND_ARG_INFO(0, value)
++#endif
+ ZEND_END_ARG_INFO()
+
+ static zend_function_entry php_driver_type_collection_methods[] = {
+@@ -129,12 +133,13 @@ static zend_object_handlers php_driver_type_collection_handlers;
+
+ static HashTable *
+ php_driver_type_collection_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -143,20 +148,18 @@ php_driver_type_collection_gc(
+
+ static HashTable *
+ php_driver_type_collection_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -170,6 +173,9 @@ php_driver_type_collection_properties(
+ static int
+ php_driver_type_collection_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -211,7 +217,7 @@ void php_driver_define_TypeCollection(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_collection_handlers.get_gc = php_driver_type_collection_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_collection_handlers.compare = php_driver_type_collection_compare;
+ #else
+ php_driver_type_collection_handlers.compare_objects = php_driver_type_collection_compare;
+diff --git a/ext/src/Type/Custom.c b/ext/src/Type/Custom.c
+index df9a4016..c7d11784 100644
+--- a/ext/src/Type/Custom.c
++++ b/ext/src/Type/Custom.c
+@@ -81,12 +81,13 @@ static zend_object_handlers php_driver_type_custom_handlers;
+
+ static HashTable *
+ php_driver_type_custom_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -95,22 +96,20 @@ php_driver_type_custom_gc(
+
+ static HashTable *
+ php_driver_type_custom_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval name;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(name);
+@@ -125,6 +124,9 @@ php_driver_type_custom_properties(
+ static int
+ php_driver_type_custom_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -169,7 +171,7 @@ void php_driver_define_TypeCustom(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_custom_handlers.get_gc = php_driver_type_custom_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_custom_handlers.compare = php_driver_type_custom_compare;
+ #else
+ php_driver_type_custom_handlers.compare_objects = php_driver_type_custom_compare;
+diff --git a/ext/src/Type/Map.c b/ext/src/Type/Map.c
+index ffeb2042..0c76e6d5 100644
+--- a/ext/src/Type/Map.c
++++ b/ext/src/Type/Map.c
+@@ -129,7 +129,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, value)
++#else
+ ZEND_ARG_INFO(0, value)
++#endif
+ ZEND_END_ARG_INFO()
+
+ static zend_function_entry php_driver_type_map_methods[] = {
+@@ -146,12 +150,13 @@ static zend_object_handlers php_driver_type_map_handlers;
+
+ static HashTable *
+ php_driver_type_map_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -160,20 +165,18 @@ php_driver_type_map_gc(
+
+ static HashTable *
+ php_driver_type_map_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -192,6 +195,9 @@ php_driver_type_map_properties(
+ static int
+ php_driver_type_map_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -236,7 +242,7 @@ void php_driver_define_TypeMap(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_map_handlers.get_gc = php_driver_type_map_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_map_handlers.compare = php_driver_type_map_compare;
+ #else
+ php_driver_type_map_handlers.compare_objects = php_driver_type_map_compare;
+diff --git a/ext/src/Type/Scalar.c b/ext/src/Type/Scalar.c
+index fd88e91c..e8c19f32 100644
+--- a/ext/src/Type/Scalar.c
++++ b/ext/src/Type/Scalar.c
+@@ -84,12 +84,13 @@ static zend_object_handlers php_driver_type_scalar_handlers;
+
+ static HashTable *
+ php_driver_type_scalar_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -98,22 +99,19 @@ php_driver_type_scalar_gc(
+
+ static HashTable *
+ php_driver_type_scalar_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval name;
+-
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ /* Used for comparison and 'text' is just an alias for 'varchar' */
+@@ -133,6 +131,9 @@ php_driver_type_scalar_properties(
+ static int
+ php_driver_type_scalar_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -172,7 +173,7 @@ void php_driver_define_TypeScalar(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_scalar_handlers.get_gc = php_driver_type_scalar_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_scalar_handlers.compare = php_driver_type_scalar_compare;
+ #else
+ php_driver_type_scalar_handlers.compare_objects = php_driver_type_scalar_compare;
+diff --git a/ext/src/Type/Set.c b/ext/src/Type/Set.c
+index 2e06ec10..d1be3065 100644
+--- a/ext/src/Type/Set.c
++++ b/ext/src/Type/Set.c
+@@ -105,7 +105,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, value)
++#else
+ ZEND_ARG_INFO(0, value)
++#endif
+ ZEND_END_ARG_INFO()
+
+ static zend_function_entry php_driver_type_set_methods[] = {
+@@ -121,12 +125,13 @@ static zend_object_handlers php_driver_type_set_handlers;
+
+ static HashTable *
+ php_driver_type_set_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -135,20 +140,18 @@ php_driver_type_set_gc(
+
+ static HashTable *
+ php_driver_type_set_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -162,6 +165,9 @@ php_driver_type_set_properties(
+ static int
+ php_driver_type_set_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -204,7 +210,7 @@ void php_driver_define_TypeSet(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_set_handlers.get_gc = php_driver_type_set_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_set_handlers.compare = php_driver_type_set_compare;
+ #else
+ php_driver_type_set_handlers.compare_objects = php_driver_type_set_compare;
+diff --git a/ext/src/Type/Tuple.c b/ext/src/Type/Tuple.c
+index d081c798..26875cce 100644
+--- a/ext/src/Type/Tuple.c
++++ b/ext/src/Type/Tuple.c
+@@ -141,7 +141,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_values, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, values)
++#else
+ ZEND_ARG_INFO(0, values)
++#endif
+ ZEND_END_ARG_INFO()
+
+ static zend_function_entry php_driver_type_tuple_methods[] = {
+@@ -157,12 +161,13 @@ static zend_object_handlers php_driver_type_tuple_handlers;
+
+ static HashTable *
+ php_driver_type_tuple_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -171,22 +176,19 @@ php_driver_type_tuple_gc(
+
+ static HashTable *
+ php_driver_type_tuple_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval types;
+-
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(types);
+@@ -202,6 +204,9 @@ php_driver_type_tuple_properties(
+ static int
+ php_driver_type_tuple_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -243,7 +248,7 @@ void php_driver_define_TypeTuple(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_tuple_handlers.get_gc = php_driver_type_tuple_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_tuple_handlers.compare = php_driver_type_tuple_compare;
+ #else
+ php_driver_type_tuple_handlers.compare_objects = php_driver_type_tuple_compare;
+diff --git a/ext/src/Type/UserType.c b/ext/src/Type/UserType.c
+index a9f5dd83..af324824 100644
+--- a/ext/src/Type/UserType.c
++++ b/ext/src/Type/UserType.c
+@@ -235,7 +235,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0)
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0)
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_ARG_VARIADIC_INFO(0, value)
++#else
+ ZEND_ARG_INFO(0, value)
++#endif
+ ZEND_END_ARG_INFO()
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_name, 0, ZEND_RETURN_VALUE, 1)
+@@ -262,12 +266,13 @@ static zend_object_handlers php_driver_type_user_type_handlers;
+
+ static HashTable *
+ php_driver_type_user_type_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -276,22 +281,20 @@ php_driver_type_user_type_gc(
+
+ static HashTable *
+ php_driver_type_user_type_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval types;
+
+- php_driver_type *self = PHP_DRIVER_GET_TYPE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_type *self = PHP5TO7_ZEND_OBJECT_GET(type, object);
+ #else
+- object
++ php_driver_type *self = PHP_DRIVER_GET_TYPE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZVAL_MAYBE_MAKE(types);
+@@ -307,6 +310,9 @@ php_driver_type_user_type_properties(
+ static int
+ php_driver_type_user_type_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_type* type1 = PHP_DRIVER_GET_TYPE(obj1);
+ php_driver_type* type2 = PHP_DRIVER_GET_TYPE(obj2);
+
+@@ -351,7 +357,7 @@ void php_driver_define_TypeUserType(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_type_user_type_handlers.get_gc = php_driver_type_user_type_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_type_user_type_handlers.compare = php_driver_type_user_type_compare;
+ #else
+ php_driver_type_user_type_handlers.compare_objects = php_driver_type_user_type_compare;
+diff --git a/ext/src/UserTypeValue.c b/ext/src/UserTypeValue.c
+index f12c916e..7bf430f0 100644
+--- a/ext/src/UserTypeValue.c
++++ b/ext/src/UserTypeValue.c
+@@ -300,9 +300,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo__construct, 0, ZEND_RETURN_VALUE, 1)
+ ZEND_ARG_INFO(0, types)
+ ZEND_END_ARG_INFO()
+
+-ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 1)
++#if PHP_MAJOR_VERSION >= 8
++ZEND_BEGIN_ARG_INFO_EX(arginfo_name_value, 0, ZEND_RETURN_VALUE, 1)
++ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ ZEND_END_ARG_INFO()
++#else
++ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 1)
++ZEND_ARG_INFO(0, value)
++ZEND_END_ARG_INFO()
++#endif
+
+ ZEND_BEGIN_ARG_INFO_EX(arginfo_name, 0, ZEND_RETURN_VALUE, 1)
+ ZEND_ARG_INFO(0, name)
+@@ -315,7 +322,11 @@ static zend_function_entry php_driver_user_type_value_methods[] = {
+ PHP_ME(UserTypeValue, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+ PHP_ME(UserTypeValue, type, arginfo_none, ZEND_ACC_PUBLIC)
+ PHP_ME(UserTypeValue, values, arginfo_none, ZEND_ACC_PUBLIC)
++#if PHP_MAJOR_VERSION >= 8
++ PHP_ME(UserTypeValue, set, arginfo_name_value, ZEND_ACC_PUBLIC)
++#else
+ PHP_ME(UserTypeValue, set, arginfo_value, ZEND_ACC_PUBLIC)
++#endif
+ PHP_ME(UserTypeValue, get, arginfo_name, ZEND_ACC_PUBLIC)
+ /* Countable */
+ PHP_ME(UserTypeValue, count, arginfo_none, ZEND_ACC_PUBLIC)
+@@ -332,12 +343,13 @@ static php_driver_value_handlers php_driver_user_type_value_handlers;
+
+ static HashTable *
+ php_driver_user_type_value_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -346,22 +358,20 @@ php_driver_user_type_value_gc(
+
+ static HashTable *
+ php_driver_user_type_value_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+ php5to7_zval values;
+
+- php_driver_user_type_value *self = PHP_DRIVER_GET_USER_TYPE_VALUE(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_user_type_value *self = PHP5TO7_ZEND_OBJECT_GET(user_type_value, object);
+ #else
+- object
++ php_driver_user_type_value *self = PHP_DRIVER_GET_USER_TYPE_VALUE(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ PHP5TO7_ZEND_HASH_UPDATE(props,
+@@ -380,6 +390,9 @@ php_driver_user_type_value_properties(
+ static int
+ php_driver_user_type_value_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ HashPosition pos1;
+ HashPosition pos2;
+ php5to7_zval *current1;
+@@ -484,7 +497,7 @@ void php_driver_define_UserTypeValue(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_user_type_value_handlers.std.get_gc = php_driver_user_type_value_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_user_type_value_handlers.std.compare = php_driver_user_type_value_compare;
+ #else
+ php_driver_user_type_value_handlers.std.compare_objects = php_driver_user_type_value_compare;
+diff --git a/ext/src/Uuid.c b/ext/src/Uuid.c
+index ef6c4a04..71e98a8b 100644
+--- a/ext/src/Uuid.c
++++ b/ext/src/Uuid.c
+@@ -119,12 +119,13 @@ static php_driver_value_handlers php_driver_uuid_handlers;
+
+ static HashTable *
+ php_driver_uuid_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -133,10 +134,10 @@ php_driver_uuid_gc(
+
+ static HashTable *
+ php_driver_uuid_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -145,13 +146,11 @@ php_driver_uuid_properties(
+ php5to7_zval uuid;
+ php5to7_zval version;
+
+- php_driver_uuid *self = PHP_DRIVER_GET_UUID(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_uuid *self = PHP5TO7_ZEND_OBJECT_GET(uuid, object);
+ #else
+- object
++ php_driver_uuid *self = PHP_DRIVER_GET_UUID(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ cass_uuid_string(self->uuid, string);
+@@ -173,6 +172,9 @@ php_driver_uuid_properties(
+ static int
+ php_driver_uuid_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_uuid *uuid1 = NULL;
+ php_driver_uuid *uuid2 = NULL;
+
+@@ -230,7 +232,7 @@ php_driver_define_Uuid(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_uuid_handlers.std.get_gc = php_driver_uuid_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_uuid_handlers.std.compare = php_driver_uuid_compare;
+ #else
+ php_driver_uuid_handlers.std.compare_objects = php_driver_uuid_compare;
+diff --git a/ext/src/Varint.c b/ext/src/Varint.c
+index 2fff0e8b..84e70545 100644
+--- a/ext/src/Varint.c
++++ b/ext/src/Varint.c
+@@ -372,12 +372,13 @@ static php_driver_value_handlers php_driver_varint_handlers;
+
+ static HashTable *
+ php_driver_varint_gc(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- php5to7_zval_gc table, int *n TSRMLS_DC)
++ php5to7_zval_gc table, int *n TSRMLS_DC
++)
+ {
+ *table = NULL;
+ *n = 0;
+@@ -386,10 +387,10 @@ php_driver_varint_gc(
+
+ static HashTable *
+ php_driver_varint_properties(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object
+ #else
+- zval *object TSRMLS_DC
++ zval *object TSRMLS_DC
+ #endif
+ )
+ {
+@@ -398,13 +399,11 @@ php_driver_varint_properties(
+ php5to7_zval type;
+ php5to7_zval value;
+
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+ HashTable *props = zend_std_get_properties(object TSRMLS_CC);
+
+ php_driver_format_integer(self->data.varint.value, &string, &string_len);
+@@ -423,6 +422,9 @@ php_driver_varint_properties(
+ static int
+ php_driver_varint_compare(zval *obj1, zval *obj2 TSRMLS_DC)
+ {
++#if PHP_MAJOR_VERSION >= 8
++ ZEND_COMPARE_OBJECTS_FALLBACK(obj1, obj2);
++#endif
+ php_driver_numeric *varint1 = NULL;
+ php_driver_numeric *varint2 = NULL;
+
+@@ -444,20 +446,19 @@ php_driver_varint_hash_value(zval *obj TSRMLS_DC)
+
+ static int
+ php_driver_varint_cast(
+-#if PHP_VERSION_ID >= 80000
+- zend_object *object,
++#if PHP_MAJOR_VERSION >= 8
++ zend_object *object,
+ #else
+- zval *object,
++ zval *object,
+ #endif
+- zval *retval, int type TSRMLS_DC)
++ zval *retval, int type TSRMLS_DC
++)
+ {
+- php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(
+-#if PHP_VERSION_ID >= 80000
+- (zval*) object
++#if PHP_MAJOR_VERSION >= 8
++ php_driver_numeric *self = PHP5TO7_ZEND_OBJECT_GET(numeric, object);
+ #else
+- object
++ php_driver_numeric *self = PHP_DRIVER_GET_NUMERIC(object);
+ #endif
+- );
+
+ switch (type) {
+ case IS_LONG:
+@@ -510,7 +511,7 @@ void php_driver_define_Varint(TSRMLS_D)
+ #if PHP_VERSION_ID >= 50400
+ php_driver_varint_handlers.std.get_gc = php_driver_varint_gc;
+ #endif
+-#if PHP_VERSION_ID >= 80000
++#if PHP_MAJOR_VERSION >= 8
+ php_driver_varint_handlers.std.compare = php_driver_varint_compare;
+ #else
+ php_driver_varint_handlers.std.compare_objects = php_driver_varint_compare;
+diff --git a/ext/util/hash.c b/ext/util/hash.c
+index 93b5f2a7..9ca91349 100644
+--- a/ext/util/hash.c
++++ b/ext/util/hash.c
+@@ -115,14 +115,14 @@ php_driver_value_compare(zval* zvalue1, zval* zvalue2 TSRMLS_DC) {
+
+ #if PHP_MAJOR_VERSION >= 7
+ case IS_OBJECT:
+- #if PHP_VERSION_ID >= 80000
++ #if PHP_MAJOR_VERSION >= 8
+ return Z_OBJ_P(zvalue1)->handlers->compare(zvalue1, zvalue2);
+ #else
+ return Z_OBJ_P(zvalue1)->handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
+ #endif
+ #else
+ case IS_OBJECT:
+- #if PHP_VERSION_ID >= 80000
++ #if PHP_MAJOR_VERSION >= 8
+ return Z_OBJVAL_P(zvalue1).handlers->compare(zvalue1, zvalue2);
+ #else
+ return Z_OBJVAL_P(zvalue1).handlers->compare_objects(zvalue1, zvalue2 TSRMLS_CC);
+From 2ad688409509b3d02d3ce23d6d3a46e8a08c61e8 Mon Sep 17 00:00:00 2001
+From: Marko Dobromirovic <codespill.github@gmail.com>
+Date: Tue, 29 Dec 2020 17:41:04 +0100
+Subject: [PATCH] Add resource for Persistent Prepare Statement
+
+---
+ ext/php_driver.c | 27 +++++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/ext/php_driver.c b/ext/php_driver.c
+index ba0cb2c2..26eea743 100644
+--- a/ext/php_driver.c
++++ b/ext/php_driver.c
+@@ -39,6 +39,7 @@
+ /* Resources */
+ #define PHP_DRIVER_CLUSTER_RES_NAME PHP_DRIVER_NAMESPACE " Cluster"
+ #define PHP_DRIVER_SESSION_RES_NAME PHP_DRIVER_NAMESPACE " Session"
++#define PHP_DRIVER_PREPARED_STATEMENT_RES_NAME PHP_DRIVER_NAMESPACE " PreparedStatement"
+
+ static uv_once_t log_once = UV_ONCE_INIT;
+ static char *log_location = NULL;
+@@ -134,6 +135,26 @@ php_driver_session_dtor(php5to7_zend_resource rsrc TSRMLS_DC)
+ }
+ }
+
++static int le_php_driver_prepared_statement_res;
++int
++php_le_php_driver_prepared_statement()
++{
++ return le_php_driver_prepared_statement_res;
++}
++static void
++php_driver_prepared_statement_dtor(php5to7_zend_resource rsrc TSRMLS_DC)
++{
++ php_driver_pprepared_statement *preparedStmt = (php_driver_pprepared_statement*) rsrc->ptr;
++
++ if (preparedStmt) {
++ cass_future_free(preparedStmt->future);
++ php_driver_del_peref(&preparedStmt->ref, 1);
++ pefree(preparedStmt, 1);
++ PHP_DRIVER_G(persistent_prepared_statements)--;
++ rsrc->ptr = NULL;
++ }
++}
++
+ static void
+ php_driver_log(const CassLogMessage *message, void *data);
+
+@@ -414,6 +435,7 @@ static PHP_GINIT_FUNCTION(php_driver)
+ php_driver_globals->uuid_gen_pid = 0;
+ php_driver_globals->persistent_clusters = 0;
+ php_driver_globals->persistent_sessions = 0;
++ php_driver_globals->persistent_prepared_statements = 0;
+ PHP5TO7_ZVAL_UNDEF(php_driver_globals->type_varchar);
+ PHP5TO7_ZVAL_UNDEF(php_driver_globals->type_text);
+ PHP5TO7_ZVAL_UNDEF(php_driver_globals->type_blob);
+@@ -454,6 +476,11 @@ PHP_MINIT_FUNCTION(php_driver)
+ PHP_DRIVER_SESSION_RES_NAME,
+ module_number);
+
++ le_php_driver_prepared_statement_res =
++ zend_register_list_destructors_ex(NULL, php_driver_prepared_statement_dtor,
++ PHP_DRIVER_PREPARED_STATEMENT_RES_NAME,
++ module_number);
++
+ php_driver_define_Exception(TSRMLS_C);
+ php_driver_define_InvalidArgumentException(TSRMLS_C);
+ php_driver_define_DomainException(TSRMLS_C);
+From 3a24c5c467d2c5e9e58360c2b14fef27b676b325 Mon Sep 17 00:00:00 2001
+From: Dusan Malusev <dmalusev@nanointeractive.com>
+Date: Tue, 29 Mar 2022 14:07:49 +0200
+Subject: [PATCH] Adding support for PHP 8.1
+
+Signed-off-by: Dusan Malusev <dmalusev@nanointeractive.com>
+---
+ .gitignore | 1 +
+ ext/src/Collection.c | 4 ++++
+ ext/src/Map.c | 5 +++++
+ ext/src/SSLOptions/Builder.c | 38 ++++++++++++++++++++++++++----------
+ ext/src/Set.c | 5 +++++
+ ext/src/Tuple.c | 4 ++++
+ ext/src/UserTypeValue.c | 5 +++++
+ 7 files changed, 52 insertions(+), 10 deletions(-)
+
+diff --git a/ext/src/Collection.c b/ext/src/Collection.c
+index 1083bf07..54c25b4a 100644
+--- a/ext/src/Collection.c
++++ b/ext/src/Collection.c
+@@ -478,7 +478,11 @@ void php_driver_define_Collection(TSRMLS_D)
+ #endif
+ php_driver_collection_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_collection_ce->create_object = php_driver_collection_new;
++#if PHP_VERSION_ID < 80100
+ zend_class_implements(php_driver_collection_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
++#else
++ zend_class_implements(php_driver_collection_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator);
++#endif
+
+ php_driver_collection_handlers.hash_value = php_driver_collection_hash_value;
+ php_driver_collection_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/Map.c b/ext/src/Map.c
+index b453e131..dd553713 100644
+--- a/ext/src/Map.c
++++ b/ext/src/Map.c
+@@ -624,7 +624,12 @@ void php_driver_define_Map(TSRMLS_D)
+ #endif
+ php_driver_map_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_map_ce->create_object = php_driver_map_new;
++
++#if PHP_VERSION_ID < 80100
+ zend_class_implements(php_driver_map_ce TSRMLS_CC, 3, spl_ce_Countable, zend_ce_iterator, zend_ce_arrayaccess);
++#else
++ zend_class_implements(php_driver_map_ce TSRMLS_CC, 3, zend_ce_countable, zend_ce_iterator, zend_ce_arrayaccess);
++#endif
+
+ php_driver_map_handlers.hash_value = php_driver_map_hash_value;
+ php_driver_map_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/SSLOptions/Builder.c b/ext/src/SSLOptions/Builder.c
+index 2a9686d1..c56f2ff8 100644
+--- a/ext/src/SSLOptions/Builder.c
++++ b/ext/src/SSLOptions/Builder.c
+@@ -125,11 +125,17 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
+ PHP5TO7_MAYBE_EFREE(args);
+ }
+
++#if PHP_VERSION_ID < 80100
+ php_stat(Z_STRVAL_P(path), Z_STRLEN_P(path), FS_IS_R, &readable TSRMLS_CC);
++#else
++ zend_string* path_str = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), false);
++ php_stat(path_str, FS_IS_R, &readable TSRMLS_CC);
++ zend_string_release(path_str);
++#endif
+
+ if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) {
+ zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC,
+- "The path '%s' doesn't exist or is not readable", Z_STRVAL_P(path));
++ "The path '%s' doesn't exist or is not readable", Z_STRVAL_P(path));
+ PHP5TO7_MAYBE_EFREE(args);
+ return;
+ }
+@@ -146,10 +152,10 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
+ }
+
+ builder->trusted_certs_cnt = argc;
+- builder->trusted_certs = ecalloc(argc, sizeof(char *));
++ builder->trusted_certs = ecalloc(argc, sizeof(char*));
+
+ for (i = 0; i < argc; i++) {
+- zval *path = PHP5TO7_ZVAL_ARG(args[i]);
++ zval* path = PHP5TO7_ZVAL_ARG(args[i]);
+
+ builder->trusted_certs[i] = estrndup(Z_STRVAL_P(path), Z_STRLEN_P(path));
+ }
+@@ -161,7 +167,7 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts)
+ PHP_METHOD(SSLOptionsBuilder, withVerifyFlags)
+ {
+ long flags;
+- php_driver_ssl_builder *builder = NULL;
++ php_driver_ssl_builder* builder = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ return;
+@@ -176,20 +182,26 @@ PHP_METHOD(SSLOptionsBuilder, withVerifyFlags)
+
+ PHP_METHOD(SSLOptionsBuilder, withClientCert)
+ {
+- char *client_cert;
++ char* client_cert;
+ php5to7_size client_cert_len;
+ zval readable;
+- php_driver_ssl_builder *builder = NULL;
++ php_driver_ssl_builder* builder = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &client_cert, &client_cert_len) == FAILURE) {
+ return;
+ }
+
++#if PHP_VERSION_ID < 80100
+ php_stat(client_cert, client_cert_len, FS_IS_R, &readable TSRMLS_CC);
++#else
++ zend_string* client_cert_str = zend_string_init(client_cert, client_cert_len, false);
++ php_stat(client_cert_str, FS_IS_R, &readable TSRMLS_CC);
++ zend_string_release(client_cert_str);
++#endif
+
+ if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) {
+ zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC,
+- "The path '%s' doesn't exist or is not readable", client_cert);
++ "The path '%s' doesn't exist or is not readable", client_cert);
+ return;
+ }
+
+@@ -205,17 +217,23 @@ PHP_METHOD(SSLOptionsBuilder, withClientCert)
+
+ PHP_METHOD(SSLOptionsBuilder, withPrivateKey)
+ {
+- char *private_key;
+- char *passphrase = NULL;
++ char* private_key;
++ char* passphrase = NULL;
+ php5to7_size private_key_len, passphrase_len;
+ zval readable;
+- php_driver_ssl_builder *builder = NULL;
++ php_driver_ssl_builder* builder = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &private_key, &private_key_len, &passphrase, &passphrase_len) == FAILURE) {
+ return;
+ }
+
++#if PHP_VERSION_ID < 80100
+ php_stat(private_key, private_key_len, FS_IS_R, &readable TSRMLS_CC);
++#else
++ zend_string* private_key_str = zend_string_init(private_key, private_key_len, false);
++ php_stat(private_key_str, FS_IS_R, &readable TSRMLS_CC);
++ zend_string_release(private_key_str);
++#endif
+
+ if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) {
+ zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC,
+diff --git a/ext/src/Set.c b/ext/src/Set.c
+index 5e866d21..7757b9f8 100644
+--- a/ext/src/Set.c
++++ b/ext/src/Set.c
+@@ -456,7 +456,12 @@ void php_driver_define_Set(TSRMLS_D)
+ #endif
+ php_driver_set_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_set_ce->create_object = php_driver_set_new;
++
++#if PHP_VERSION_ID < 80100
+ zend_class_implements(php_driver_set_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
++#else
++ zend_class_implements(php_driver_set_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator);
++#endif
+
+ php_driver_set_handlers.hash_value = php_driver_set_hash_value;
+ php_driver_set_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/Tuple.c b/ext/src/Tuple.c
+index 815dba98..5844baf4 100644
+--- a/ext/src/Tuple.c
++++ b/ext/src/Tuple.c
+@@ -465,7 +465,11 @@ void php_driver_define_Tuple(TSRMLS_D)
+ #endif
+ php_driver_tuple_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_tuple_ce->create_object = php_driver_tuple_new;
++#if PHP_VERSION_ID < 80100
+ zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
++#else
++ zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator);
++#endif
+
+ php_driver_tuple_handlers.hash_value = php_driver_tuple_hash_value;
+ php_driver_tuple_handlers.std.clone_obj = NULL;
+diff --git a/ext/src/UserTypeValue.c b/ext/src/UserTypeValue.c
+index 7bf430f0..8ba14bf0 100644
+--- a/ext/src/UserTypeValue.c
++++ b/ext/src/UserTypeValue.c
+@@ -504,7 +504,12 @@ void php_driver_define_UserTypeValue(TSRMLS_D)
+ #endif
+ php_driver_user_type_value_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
+ php_driver_user_type_value_ce->create_object = php_driver_user_type_value_new;
++
++#if PHP_VERSION_ID < 80100
+ zend_class_implements(php_driver_user_type_value_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator);
++#else
++ zend_class_implements(php_driver_user_type_value_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator);
++#endif
+
+ php_driver_user_type_value_handlers.hash_value = php_driver_user_type_value_hash_value;
+ php_driver_user_type_value_handlers.std.clone_obj = NULL;