From b48275810b220667d104a91b0285aa67150773ee Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 16 Sep 2022 17:25:46 +0200 Subject: add patch for PHP 8.2 from https://github.com/nano-interactive/cassandra-php-driver/pull/36 --- .gitignore | 2 + 36.patch | 675 ++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-cassandra.spec | 15 +- 3 files changed, 685 insertions(+), 7 deletions(-) create mode 100644 36.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/36.patch b/36.patch new file mode 100644 index 0000000..147f5ab --- /dev/null +++ b/36.patch @@ -0,0 +1,675 @@ +From 347323b7b551bd7d33f50f71bf73166d3bbbb127 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 16 Sep 2022 16:45:18 +0200 +Subject: [PATCH 1/3] fix PHP5TO7_ZEND_HASH_FOREACH_STR_KEY_VAL for PHP 8.2 + +--- + ext/php_driver.h | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/ext/php_driver.h b/ext/php_driver.h +index de0b8355..064b842b 100644 +--- a/ext/php_driver.h ++++ b/ext/php_driver.h +@@ -190,6 +190,19 @@ php5to7_string_compare(php5to7_string s1, php5to7_string s2) + #define PHP5TO7_ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \ + ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) + ++#if PHP_VERSION_ID >= 80200 ++ ++#define PHP5TO7_ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \ ++ ZEND_HASH_FOREACH(ht, 0); \ ++ if (__key) { \ ++ (_key) = ZSTR_VAL(__key); \ ++ } else { \ ++ (_key) = NULL; \ ++ } \ ++ _val = _z; ++ ++#else ++ + #define PHP5TO7_ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \ + ZEND_HASH_FOREACH(ht, 0); \ + if (_p->key) { \ +@@ -199,6 +212,8 @@ php5to7_string_compare(php5to7_string s1, php5to7_string s2) + } \ + _val = _z; + ++#endif ++ + #define PHP5TO7_ZEND_HASH_FOREACH_END(ht) ZEND_HASH_FOREACH_END() + + #define PHP5TO7_ZEND_HASH_GET_CURRENT_DATA(ht, res) \ + +From b396aee7428ad5c64f3954d1ee79a7446e9243a2 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 16 Sep 2022 16:57:03 +0200 +Subject: [PATCH 2/3] Fix __toString prototype on PHP 8.2 + +--- + ext/src/Bigint.c | 9 ++++++++- + ext/src/Blob.c | 9 ++++++++- + ext/src/Date.c | 9 ++++++++- + ext/src/Decimal.c | 9 ++++++++- + ext/src/Duration.c | 9 ++++++++- + ext/src/Float.c | 9 ++++++++- + ext/src/Inet.c | 9 ++++++++- + ext/src/Smallint.c | 9 ++++++++- + ext/src/Time.c | 9 ++++++++- + ext/src/Timestamp.c | 9 ++++++++- + ext/src/Timeuuid.c | 9 ++++++++- + ext/src/Tinyint.c | 9 ++++++++- + ext/src/Type.c | 9 ++++++++- + ext/src/Type/Collection.c | 9 ++++++++- + ext/src/Type/Custom.c | 9 ++++++++- + ext/src/Type/Map.c | 9 ++++++++- + ext/src/Type/Scalar.c | 9 ++++++++- + ext/src/Type/Set.c | 9 ++++++++- + ext/src/Type/Tuple.c | 9 ++++++++- + ext/src/Type/UserType.c | 9 ++++++++- + ext/src/Uuid.c | 9 ++++++++- + ext/src/Varint.c | 9 ++++++++- + 22 files changed, 176 insertions(+), 22 deletions(-) + +diff --git a/ext/src/Bigint.c b/ext/src/Bigint.c +index d66dae38..c98ed567 100644 +--- a/ext/src/Bigint.c ++++ b/ext/src/Bigint.c +@@ -371,9 +371,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_bigint_methods[] = { + PHP_ME(Bigint, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Bigint, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Bigint, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Bigint, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Bigint, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Bigint, add, arginfo_num, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Blob.c b/ext/src/Blob.c +index 84acc337..d33f2e5f 100644 +--- a/ext/src/Blob.c ++++ b/ext/src/Blob.c +@@ -101,9 +101,16 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_blob_methods[] = { + PHP_ME(Blob, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Blob, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Blob, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Blob, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Blob, bytes, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Blob, toBinaryString, arginfo_none, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Date.c b/ext/src/Date.c +index 8d4e654d..1107a929 100644 +--- a/ext/src/Date.c ++++ b/ext/src/Date.c +@@ -180,13 +180,20 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_date_methods[] = { + PHP_ME(Date, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(Date, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Date, seconds, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Date, toDateTime, arginfo_time, ZEND_ACC_PUBLIC) + PHP_ME(Date, fromDateTime, arginfo_datetime, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +- PHP_ME(Date, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Date, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_FE_END + }; + +diff --git a/ext/src/Decimal.c b/ext/src/Decimal.c +index d2956ef1..b524ed89 100644 +--- a/ext/src/Decimal.c ++++ b/ext/src/Decimal.c +@@ -490,9 +490,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_decimal_methods[] = { + PHP_ME(Decimal, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Decimal, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Decimal, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Decimal, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Decimal, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Decimal, scale, arginfo_none, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Duration.c b/ext/src/Duration.c +index 53ebb43c..677ce9ec 100644 +--- a/ext/src/Duration.c ++++ b/ext/src/Duration.c +@@ -213,13 +213,20 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo__construct, 0, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, nanos) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_duration_methods[] = { + PHP_ME(Duration, __construct, arginfo__construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_ME(Duration, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Duration, months, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Duration, days, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Duration, nanos, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(Duration, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Duration, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_FE_END + }; + +diff --git a/ext/src/Float.c b/ext/src/Float.c +index cc04fb35..141b65e9 100644 +--- a/ext/src/Float.c ++++ b/ext/src/Float.c +@@ -346,9 +346,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_float_methods[] = { + PHP_ME(Float, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Float, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Float, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Float, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Float, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Float, isInfinite, arginfo_none, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Inet.c b/ext/src/Inet.c +index b2fd4e57..1545be15 100644 +--- a/ext/src/Inet.c ++++ b/ext/src/Inet.c +@@ -90,9 +90,16 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_inet_methods[] = { + PHP_ME(Inet, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Inet, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Inet, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Inet, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Inet, address, arginfo_none, ZEND_ACC_PUBLIC) + PHP_FE_END +diff --git a/ext/src/Smallint.c b/ext/src/Smallint.c +index 3b86ebac..2bdf82b0 100644 +--- a/ext/src/Smallint.c ++++ b/ext/src/Smallint.c +@@ -403,9 +403,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_smallint_methods[] = { + PHP_ME(Smallint, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Smallint, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Smallint, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Smallint, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Smallint, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Smallint, add, arginfo_num, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Time.c b/ext/src/Time.c +index 89f6b022..52c21bcc 100644 +--- a/ext/src/Time.c ++++ b/ext/src/Time.c +@@ -205,12 +205,19 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_time_methods[] = { + PHP_ME(Time, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(Time, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Time, seconds, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Time, fromDateTime, arginfo_datetime, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +- PHP_ME(Time, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Time, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_FE_END + }; + +diff --git a/ext/src/Timestamp.c b/ext/src/Timestamp.c +index bb4cfef4..3e06af0d 100644 +--- a/ext/src/Timestamp.c ++++ b/ext/src/Timestamp.c +@@ -173,13 +173,20 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + 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, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Timestamp, microtime, arginfo_microtime, ZEND_ACC_PUBLIC) + PHP_ME(Timestamp, toDateTime, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(Timestamp, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Timestamp, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_FE_END + }; + +diff --git a/ext/src/Timeuuid.c b/ext/src/Timeuuid.c +index 37501095..e11a645a 100644 +--- a/ext/src/Timeuuid.c ++++ b/ext/src/Timeuuid.c +@@ -169,9 +169,16 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_timeuuid_methods[] = { + PHP_ME(Timeuuid, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Timeuuid, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Timeuuid, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Timeuuid, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Timeuuid, uuid, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Timeuuid, version, arginfo_none, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Tinyint.c b/ext/src/Tinyint.c +index cafd1dd6..5510f06b 100644 +--- a/ext/src/Tinyint.c ++++ b/ext/src/Tinyint.c +@@ -402,9 +402,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_tinyint_methods[] = { + PHP_ME(Tinyint, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Tinyint, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Tinyint, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Tinyint, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Tinyint, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Tinyint, add, arginfo_num, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Type.c b/ext/src/Type.c +index 67720bf1..652b9411 100644 +--- a/ext/src/Type.c ++++ b/ext/src/Type.c +@@ -196,6 +196,13 @@ PHP_METHOD(Type, map) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_types, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, types) +@@ -215,7 +222,7 @@ ZEND_END_ARG_INFO() + + static zend_function_entry php_driver_type_methods[] = { + PHP_ABSTRACT_ME(Type, name, arginfo_none) +- PHP_ABSTRACT_ME(Type, __toString, arginfo_none) ++ PHP_ABSTRACT_ME(Type, __toString, arginfo_tostring) + + #define XX_SCALAR_METHOD(name, _) PHP_ME(Type, name, arginfo_none, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL) + PHP_DRIVER_SCALAR_TYPES_MAP(XX_SCALAR_METHOD) +diff --git a/ext/src/Type/Collection.c b/ext/src/Type/Collection.c +index 6c36c6f9..7e1e6cb8 100644 +--- a/ext/src/Type/Collection.c ++++ b/ext/src/Type/Collection.c +@@ -112,6 +112,13 @@ PHP_METHOD(TypeCollection, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, value) +@@ -124,7 +131,7 @@ static zend_function_entry php_driver_type_collection_methods[] = { + PHP_ME(TypeCollection, __construct, arginfo_none, ZEND_ACC_PRIVATE) + PHP_ME(TypeCollection, name, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeCollection, valueType, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeCollection, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeCollection, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeCollection, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END + }; +diff --git a/ext/src/Type/Custom.c b/ext/src/Type/Custom.c +index c7d11784..f7ce4eb5 100644 +--- a/ext/src/Type/Custom.c ++++ b/ext/src/Type/Custom.c +@@ -65,6 +65,13 @@ PHP_METHOD(TypeCustom, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() +@@ -72,7 +79,7 @@ ZEND_END_ARG_INFO() + static zend_function_entry php_driver_type_custom_methods[] = { + PHP_ME(TypeCustom, __construct, arginfo_none, ZEND_ACC_PRIVATE) + PHP_ME(TypeCustom, name, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeCustom, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeCustom, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeCustom, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END + }; +diff --git a/ext/src/Type/Map.c b/ext/src/Type/Map.c +index 0c76e6d5..6f0b67a8 100644 +--- a/ext/src/Type/Map.c ++++ b/ext/src/Type/Map.c +@@ -128,6 +128,13 @@ PHP_METHOD(TypeMap, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, value) +@@ -141,7 +148,7 @@ static zend_function_entry php_driver_type_map_methods[] = { + PHP_ME(TypeMap, name, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeMap, keyType, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeMap, valueType, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeMap, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeMap, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeMap, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END + }; +diff --git a/ext/src/Type/Scalar.c b/ext/src/Type/Scalar.c +index e8c19f32..992d1bd1 100644 +--- a/ext/src/Type/Scalar.c ++++ b/ext/src/Type/Scalar.c +@@ -65,6 +65,13 @@ PHP_METHOD(TypeScalar, create) + php_driver_scalar_init(INTERNAL_FUNCTION_PARAM_PASSTHRU); + } + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + +@@ -75,7 +82,7 @@ ZEND_END_ARG_INFO() + static zend_function_entry php_driver_type_scalar_methods[] = { + PHP_ME(TypeScalar, __construct, arginfo_none, ZEND_ACC_PRIVATE) + PHP_ME(TypeScalar, name, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeScalar, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeScalar, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeScalar, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END + }; +diff --git a/ext/src/Type/Set.c b/ext/src/Type/Set.c +index d1be3065..d97697c6 100644 +--- a/ext/src/Type/Set.c ++++ b/ext/src/Type/Set.c +@@ -104,6 +104,13 @@ PHP_METHOD(TypeSet, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, value) +@@ -116,7 +123,7 @@ static zend_function_entry php_driver_type_set_methods[] = { + PHP_ME(TypeSet, __construct, arginfo_none, ZEND_ACC_PRIVATE) + PHP_ME(TypeSet, name, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeSet, valueType, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeSet, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeSet, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeSet, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END + }; +diff --git a/ext/src/Type/Tuple.c b/ext/src/Type/Tuple.c +index 26875cce..13ae7dc2 100644 +--- a/ext/src/Type/Tuple.c ++++ b/ext/src/Type/Tuple.c +@@ -140,6 +140,13 @@ PHP_METHOD(TypeTuple, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_values, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, values) +@@ -151,7 +158,7 @@ ZEND_END_ARG_INFO() + static zend_function_entry php_driver_type_tuple_methods[] = { + PHP_ME(TypeTuple, __construct, arginfo_none, ZEND_ACC_PRIVATE) + PHP_ME(TypeTuple, name, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeTuple, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeTuple, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeTuple, types, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeTuple, create, arginfo_values, ZEND_ACC_PUBLIC) + PHP_FE_END +diff --git a/ext/src/Type/UserType.c b/ext/src/Type/UserType.c +index af324824..f5b5d537 100644 +--- a/ext/src/Type/UserType.c ++++ b/ext/src/Type/UserType.c +@@ -234,6 +234,13 @@ PHP_METHOD(TypeUserType, create) + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) + #if PHP_MAJOR_VERSION >= 8 + ZEND_ARG_VARIADIC_INFO(0, value) +@@ -256,7 +263,7 @@ static zend_function_entry php_driver_type_user_type_methods[] = { + PHP_ME(TypeUserType, name, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeUserType, withKeyspace, arginfo_keyspace, ZEND_ACC_PUBLIC) + PHP_ME(TypeUserType, keyspace, arginfo_none, ZEND_ACC_PUBLIC) +- PHP_ME(TypeUserType, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(TypeUserType, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(TypeUserType, types, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(TypeUserType, create, arginfo_value, ZEND_ACC_PUBLIC) + PHP_FE_END +diff --git a/ext/src/Uuid.c b/ext/src/Uuid.c +index 71e98a8b..67d99e5c 100644 +--- a/ext/src/Uuid.c ++++ b/ext/src/Uuid.c +@@ -106,9 +106,16 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_uuid_methods[] = { + PHP_ME(Uuid, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Uuid, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Uuid, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Uuid, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Uuid, uuid, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Uuid, version, arginfo_none, ZEND_ACC_PUBLIC) +diff --git a/ext/src/Varint.c b/ext/src/Varint.c +index 84e70545..d39929f7 100644 +--- a/ext/src/Varint.c ++++ b/ext/src/Varint.c +@@ -350,9 +350,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, num) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tostring, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++#else ++#define arginfo_tostring arginfo_none ++#endif ++ + static zend_function_entry php_driver_varint_methods[] = { + PHP_ME(Varint, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) +- PHP_ME(Varint, __toString, arginfo_none, ZEND_ACC_PUBLIC) ++ PHP_ME(Varint, __toString, arginfo_tostring, ZEND_ACC_PUBLIC) + PHP_ME(Varint, type, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Varint, value, arginfo_none, ZEND_ACC_PUBLIC) + PHP_ME(Varint, add, arginfo_num, ZEND_ACC_PUBLIC) + +From 70809383856f46510611b65d15827db3f779f11e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 16 Sep 2022 17:13:43 +0200 +Subject: [PATCH 3/3] fix zend_hash_sort usage on PHP 8 + +--- + ext/util/hash.c | 17 +++++++++++------ + ext/util/hash.h | 4 ++++ + 2 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/ext/util/hash.c b/ext/util/hash.c +index 9ca91349..0fc8c627 100644 +--- a/ext/util/hash.c ++++ b/ext/util/hash.c +@@ -136,20 +136,25 @@ php_driver_value_compare(zval* zvalue1, zval* zvalue2 TSRMLS_DC) { + return 1; + } + ++#if PHP_MAJOR_VERSION < 7 + int php_driver_data_compare(const void* a, const void* b TSRMLS_DC) { + Bucket *f, *s; + zval *first, *second; + +-#if PHP_MAJOR_VERSION >= 7 +- f = (Bucket *)a; +- s = (Bucket *)b; +- first = &f->val; +- second = &s->val; +-#else + f = *((Bucket **) a); + s = *((Bucket **) b); + first = *((zval **) f->pData); + second = *((zval **) s->pData); ++ ++#elif PHP_MAJOR_VERSION < 8 ++int php_driver_data_compare(const void *a, const void *b TSRMLS_DC) { ++ zval *first = &((Bucket*)a)->val; ++ zval *second = &((Bucket*)b)->val; ++ ++#else ++int php_driver_data_compare(Bucket *a, Bucket *b) { ++ zval *first = &a->val; ++ zval *second = &b->val; + #endif + + return php_driver_value_compare(first, second TSRMLS_CC); +diff --git a/ext/util/hash.h b/ext/util/hash.h +index 7a6a5487..4433b23c 100644 +--- a/ext/util/hash.h ++++ b/ext/util/hash.h +@@ -51,7 +51,11 @@ struct php_driver_set_entry_ { + + unsigned php_driver_value_hash(zval* zvalue TSRMLS_DC); + int php_driver_value_compare(zval* zvalue1, zval* zvalue2 TSRMLS_DC); ++#if PHP_MAJOR_VERSION < 8 + int php_driver_data_compare(const void* a, const void* b TSRMLS_DC); ++#else ++int php_driver_data_compare(Bucket *a, Bucket *b); ++#endif + + unsigned php_driver_mpz_hash(unsigned seed, mpz_t n); + diff --git a/php-pecl-cassandra.spec b/php-pecl-cassandra.spec index c6a5e07..f222a51 100644 --- a/php-pecl-cassandra.spec +++ b/php-pecl-cassandra.spec @@ -8,7 +8,6 @@ # %if 0%{?scl:1} -%global sub_prefix %{scl_prefix} %scl_package php-pecl-cassandra %endif @@ -32,9 +31,9 @@ %global buildver %(pkg-config --silence-errors --modversion cassandra 2>/dev/null || echo 65536) Summary: DataStax PHP Driver for Apache Cassandra -Name: %{?sub_prefix}php-pecl-%{pecl_name} +Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 1.3.2 -Release: 10%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 11%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: ASL 2.0 URL: https://pecl.php.net/package/%{pecl_name} @@ -52,6 +51,7 @@ Patch3: https://patch-diff.githubusercontent.com/raw/datastax/php-driver/p # Fix for PHP 8 from https://github.com/nano-interactive/cassandra-php-driver/commits/v1.3.x/ext Patch4: %{pecl_name}-php8.patch Patch5: https://patch-diff.githubusercontent.com/raw/nano-interactive/cassandra-php-driver/pull/29.patch +Patch6: https://patch-diff.githubusercontent.com/raw/nano-interactive/cassandra-php-driver/pull/36.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -70,10 +70,6 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif %description @@ -106,6 +102,7 @@ cd NTS %if "%{php_version}" > "8.0" %patch4 -p2 -b .php8 %patch5 -p2 -b .php81 +%patch6 -p2 -b .php82 %endif # Sanity check, really often broken @@ -243,6 +240,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Fri Sep 16 2022 Remi Collet - 1.3.2-11 +- add patch for PHP 8.2 from + https://github.com/nano-interactive/cassandra-php-driver/pull/36 + * Wed Jun 15 2022 Remi Collet - 1.3.2-10 - add patch for PHP 8 from extension fork https://github.com/nano-interactive/cassandra-php-driver/ -- cgit