From 4c92663ff2000c5ebaff64c82d11cb5c960fee5a Mon Sep 17 00:00:00 2001 From: qkdreyer Date: Thu, 29 Dec 2022 15:11:40 +0100 Subject: [PATCH] feat: add php 8.2 compatibility --- Dockerfile | 5 +++-- behat.yml | 11 +++++++++++ ext/php_driver.h | 18 +++++++++++++----- ext/src/Bigint.c | 4 +++- ext/src/Blob.c | 4 +++- ext/src/Date.c | 4 +++- ext/src/Decimal.c | 4 +++- ext/src/Duration.c | 4 +++- ext/src/Float.c | 4 +++- ext/src/Inet.c | 4 +++- ext/src/Smallint.c | 4 +++- ext/src/Time.c | 4 +++- ext/src/Timestamp.c | 4 +++- ext/src/Timeuuid.c | 4 +++- ext/src/Tinyint.c | 4 +++- ext/src/Type.c | 4 +++- ext/src/Type/Collection.c | 3 ++- ext/src/Type/Custom.c | 4 +++- ext/src/Type/Map.c | 3 ++- ext/src/Type/Scalar.c | 4 +++- ext/src/Type/Set.c | 3 ++- ext/src/Type/Tuple.c | 3 ++- ext/src/Type/UserType.c | 4 +++- ext/src/Uuid.c | 4 +++- ext/src/Varint.c | 4 +++- ext/version.h | 6 +++--- features/bootstrap/FeatureContext.php | 2 +- .../function_and_aggregate_metadata.feature | 4 ++-- support/ccm.php | 4 ++-- .../SchemaMetadataIntegrationTest.php | 2 +- 30 files changed, 98 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55621533e..28b581ec3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1 +FROM php:8.2 WORKDIR /tmp/cassandra-php-driver RUN apt update -y \ @@ -36,7 +36,8 @@ COPY support support COPY tests tests COPY phpunit.xml . ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/ -RUN bin/phpunit --stop-on-error --stop-on-failure +RUN bin/phpunit --stop-on-error --stop-on-failure --testsuite unit +RUN bin/phpunit --stop-on-error --stop-on-failure --testsuite integration COPY features features COPY behat.yml . diff --git a/behat.yml b/behat.yml index 071bb4c1a..7dfd0e545 100644 --- a/behat.yml +++ b/behat.yml @@ -1,4 +1,15 @@ default: + formatters: + pretty: true + suites: + default: + filters: + tags: "~@cassandra-version-less-2.1&&~@cassandra-version-only-2.0&&~@broken" + contexts: + - FeatureContext: + cassandra_version: "4.1.0" + +cassandra-version-3.11: formatters: pretty: true suites: diff --git a/ext/php_driver.h b/ext/php_driver.h index c80b8fc2d..0b22e2d99 100644 --- a/ext/php_driver.h +++ b/ext/php_driver.h @@ -129,6 +129,9 @@ typedef zend_object php7to8_object; #define PHP7TO8_ARG_INFO_VOID_RETURN(arginfo) \ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo, 0, 0, IS_VOID, 0) \ ZEND_END_ARG_INFO() +#define PHP7TO8_ARG_INFO_STRING_RETURN(arginfo) \ + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo, 0, 0, IS_STRING, 0) \ + ZEND_END_ARG_INFO() #define PHP7TO8_ARG_INFO_BOOL_RETURN(arginfo) \ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo, 0, 0, _IS_BOOL, 0) \ ZEND_END_ARG_INFO() @@ -172,6 +175,9 @@ typedef zval php7to8_object; #define PHP7TO8_ARG_INFO_VOID_RETURN(arginfo) \ ZEND_BEGIN_ARG_INFO_EX(arginfo, 0, ZEND_RETURN_VALUE, 0) \ ZEND_END_ARG_INFO() +#define PHP7TO8_ARG_INFO_STRING_RETURN(arginfo) \ + ZEND_BEGIN_ARG_INFO_EX(arginfo, 0, ZEND_RETURN_VALUE, 0) \ + ZEND_END_ARG_INFO() #define PHP7TO8_ARG_INFO_BOOL_RETURN(arginfo) \ ZEND_BEGIN_ARG_INFO_EX(arginfo, 0, ZEND_RETURN_VALUE, 0) \ ZEND_END_ARG_INFO() @@ -200,6 +206,12 @@ typedef zval php7to8_object; ZEND_END_ARG_INFO() #endif +#if ((PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION >= 2) || PHP_MAJOR_VERSION > 8) +#define PHP7TO82_ZEND_KEY() __key ? __key->val : NULL +#else +#define PHP7TO82_ZEND_KEY() _p->key ? _p->key->val : NULL +#endif + #if PHP_MAJOR_VERSION >= 7 #define php5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce) TSRMLS_CC); @@ -276,11 +288,7 @@ php5to7_string_compare(php5to7_string s1, php5to7_string s2) #define PHP5TO7_ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \ ZEND_HASH_FOREACH(ht, 0); \ - if (_p->key) { \ - (_key) = _p->key->val; \ - } else { \ - (_key) = NULL; \ - } \ + _key = PHP7TO82_ZEND_KEY(); \ _val = _z; #define PHP5TO7_ZEND_HASH_FOREACH_END(ht) ZEND_HASH_FOREACH_END() diff --git a/ext/src/Bigint.c b/ext/src/Bigint.c index 7456b27a8..4323b1eb6 100644 --- a/ext/src/Bigint.c +++ b/ext/src/Bigint.c @@ -371,9 +371,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 f3600ef0b..fb9af45f3 100644 --- a/ext/src/Blob.c +++ b/ext/src/Blob.c @@ -101,9 +101,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 8a54cce3c..15f7d7ad7 100644 --- a/ext/src/Date.c +++ b/ext/src/Date.c @@ -180,13 +180,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/src/Decimal.c b/ext/src/Decimal.c index 407231b9e..79d89fb1e 100644 --- a/ext/src/Decimal.c +++ b/ext/src/Decimal.c @@ -490,9 +490,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 dac34a3fb..4cf1893e5 100644 --- a/ext/src/Duration.c +++ b/ext/src/Duration.c @@ -213,13 +213,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo__construct, 0, ZEND_RETURN_VALUE, 3) ZEND_ARG_INFO(0, nanos) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/src/Float.c b/ext/src/Float.c index 8a138fd42..4bc3bbdaf 100644 --- a/ext/src/Float.c +++ b/ext/src/Float.c @@ -346,9 +346,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 c9f25e4de..2999f9f03 100644 --- a/ext/src/Inet.c +++ b/ext/src/Inet.c @@ -90,9 +90,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 91704c61d..c2ac28118 100644 --- a/ext/src/Smallint.c +++ b/ext/src/Smallint.c @@ -403,9 +403,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 2f325623c..8a6eeab69 100644 --- a/ext/src/Time.c +++ b/ext/src/Time.c @@ -205,12 +205,14 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/src/Timestamp.c b/ext/src/Timestamp.c index a1112b671..55e4bb170 100644 --- a/ext/src/Timestamp.c +++ b/ext/src/Timestamp.c @@ -173,13 +173,15 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/src/Timeuuid.c b/ext/src/Timeuuid.c index 19723be0e..2fa504524 100644 --- a/ext/src/Timeuuid.c +++ b/ext/src/Timeuuid.c @@ -169,9 +169,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 e8cf098a7..f49123d8e 100644 --- a/ext/src/Tinyint.c +++ b/ext/src/Tinyint.c @@ -402,9 +402,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 605321041..eab5eb608 100644 --- a/ext/src/Type.c +++ b/ext/src/Type.c @@ -207,9 +207,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_map, 0, ZEND_RETURN_VALUE, 2) PHP_DRIVER_NAMESPACE_ZEND_ARG_OBJ_INFO(0, valueType, Type, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return) #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 9fcd35c24..4035f7c7c 100644 --- a/ext/src/Type/Collection.c +++ b/ext/src/Type/Collection.c @@ -113,12 +113,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() PHP7TO8_ARG_INFO_VARIADIC(arginfo_value, value) +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) 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_string_return, 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 ddaf3fbeb..59167ebb7 100644 --- a/ext/src/Type/Custom.c +++ b/ext/src/Type/Custom.c @@ -69,10 +69,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 47eab6f3f..8398ea915 100644 --- a/ext/src/Type/Map.c +++ b/ext/src/Type/Map.c @@ -129,13 +129,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() PHP7TO8_ARG_INFO_VARIADIC(arginfo_value, value) +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) static zend_function_entry php_driver_type_map_methods[] = { PHP_ME(TypeMap, __construct, arginfo_none, ZEND_ACC_PRIVATE) 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_string_return, 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 0c25818d4..604d85e63 100644 --- a/ext/src/Type/Scalar.c +++ b/ext/src/Type/Scalar.c @@ -72,10 +72,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_value, 0, ZEND_RETURN_VALUE, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 70211e37e..25d072671 100644 --- a/ext/src/Type/Set.c +++ b/ext/src/Type/Set.c @@ -105,12 +105,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() PHP7TO8_ARG_INFO_VARIADIC(arginfo_value, value) +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) 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_string_return, 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 58f25c56a..a58598bf8 100644 --- a/ext/src/Type/Tuple.c +++ b/ext/src/Type/Tuple.c @@ -141,11 +141,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() PHP7TO8_ARG_INFO_VARIADIC(arginfo_values, values) +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) 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_string_return, 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 0c3033da1..a6aa79f5e 100644 --- a/ext/src/Type/UserType.c +++ b/ext/src/Type/UserType.c @@ -244,13 +244,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_keyspace, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, keyspace) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + static zend_function_entry php_driver_type_user_type_methods[] = { PHP_ME(TypeUserType, __construct, arginfo_none, ZEND_ACC_PRIVATE) PHP_ME(TypeUserType, withName, arginfo_name, ZEND_ACC_PUBLIC) 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_string_return, 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 1cd5aad29..d7d93eeb1 100644 --- a/ext/src/Uuid.c +++ b/ext/src/Uuid.c @@ -106,9 +106,11 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_none, 0, ZEND_RETURN_VALUE, 0) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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 5d21fec8b..b86446145 100644 --- a/ext/src/Varint.c +++ b/ext/src/Varint.c @@ -350,9 +350,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_num, 0, ZEND_RETURN_VALUE, 1) ZEND_ARG_INFO(0, num) ZEND_END_ARG_INFO() +PHP7TO8_ARG_INFO_STRING_RETURN(arginfo_string_return) + 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_string_return, 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) diff --git a/ext/version.h b/ext/version.h index 6a6080163..3111dc0a5 100644 --- a/ext/version.h +++ b/ext/version.h @@ -4,10 +4,10 @@ /* Define Extension and Version Properties */ #define PHP_DRIVER_NAME "cassandra" #define PHP_DRIVER_MAJOR 1 -#define PHP_DRIVER_MINOR 4 +#define PHP_DRIVER_MINOR 5 #define PHP_DRIVER_RELEASE 0 #define PHP_DRIVER_STABILITY "stable" -#define PHP_DRIVER_VERSION "1.4.0" -#define PHP_DRIVER_VERSION_FULL "1.4.0" +#define PHP_DRIVER_VERSION "1.5.0" +#define PHP_DRIVER_VERSION_FULL "1.5.0" #endif /* PHP_DRIVER_VERSION_H */ diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 64a254b76..a99cd5c56 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -49,7 +49,7 @@ class FeatureContext implements Context, SnippetAcceptingContext */ public function __construct($cassandra_version) { - $this->ccm = new \CCM(); + $this->ccm = new \CCM($cassandra_version); } /** diff --git a/features/function_and_aggregate_metadata.feature b/features/function_and_aggregate_metadata.feature index b66dbbc00..7a8e03d72 100644 --- a/features/function_and_aggregate_metadata.feature +++ b/features/function_and_aggregate_metadata.feature @@ -47,11 +47,11 @@ Feature: User-defined Function (UDF) and Aggregate Metadata (UDA) Body: return Double.valueOf(Math.log(input.doubleValue())); Arguments: array ( 'input' => - Cassandra\Type\Scalar::__set_state(array( + \Cassandra\Type\Scalar::__set_state(array( 'name' => 'double', )), ) - ReturnType: Cassandra\Type\Scalar::__set_state(array( + ReturnType: \Cassandra\Type\Scalar::__set_state(array( 'name' => 'double', )) IsCalledOnNullInput: true diff --git a/support/ccm.php b/support/ccm.php index a73d1ef9f..596318cdb 100644 --- a/support/ccm.php +++ b/support/ccm.php @@ -22,7 +22,7 @@ class CCM { const DEFAULT_CLUSTER_PREFIX = "php-driver"; - const DEFAULT_CASSANDRA_VERSION = "4.0.1"; + const DEFAULT_CASSANDRA_VERSION = "4.1.0"; const PROCESS_TIMEOUT_IN_SECONDS = 480; private $clusterPrefix; private $isSilent; @@ -37,7 +37,7 @@ class CCM public function __construct($version = self::DEFAULT_CASSANDRA_VERSION, $isSilent = true, $clusterPrefix = self::DEFAULT_CLUSTER_PREFIX) { $this->version = $version; - $this->isSilent = $isSilent; + $this->isSilent = $isSilent && \getenv('CI'); $this->clusterPrefix = $clusterPrefix; $this->cluster = null; $this->session = null; diff --git a/tests/integration/Cassandra/SchemaMetadataIntegrationTest.php b/tests/integration/Cassandra/SchemaMetadataIntegrationTest.php index 31b3d326a..74dbc1de3 100644 --- a/tests/integration/Cassandra/SchemaMetadataIntegrationTest.php +++ b/tests/integration/Cassandra/SchemaMetadataIntegrationTest.php @@ -320,7 +320,7 @@ protected function assertUserDefinedFunctionsEqual($name, $function) { } } if (is_null($expectedFunction)) { - $this->fail("Unable to Locate Function: ${name}"); + $this->fail("Unable to Locate Function: {$name}"); } $this->assertEquals($expectedFunction->simpleName(),