diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c29e2130..4ec26b7f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -265,11 +265,20 @@ jobs: ports: - 9042:9042 + # 8.5 only, deliberately. This job LD_PRELOADs the ASan runtime into a + # stock (non-instrumented) setup-php binary, and PHP <= 8.4 dlopen()s + # shared extensions with RTLD_DEEPBIND, which the sanitizer runtime + # refuses to work with (google/sanitizers#611). With abort_on_error=1 + # that is a SIGABRT during startup — on opcache.so, then mysqlnd.so, and + # ultimately on cassandra.so itself — so the 8.4 leg aborted before it + # could run a single test and had been permanently red while guarding + # nothing. It is not fixable by disabling individual extensions: the + # extension under test is itself a shared object. 8.5 does not pass + # RTLD_DEEPBIND and runs the full suite clean. strategy: fail-fast: false matrix: php: - - "8.4" - "8.5" steps: diff --git a/src/RetryPolicy/DefaultPolicy.c b/src/RetryPolicy/DefaultPolicy.c index e72839e50..d3d4d9ccf 100644 --- a/src/RetryPolicy/DefaultPolicy.c +++ b/src/RetryPolicy/DefaultPolicy.c @@ -22,17 +22,11 @@ extern zend_object_handlers php_scylladb_retry_policy_default_policy_handlers; PHP_SCYLLADB_API php_scylladb_retry_policy *php_scylladb_retry_policy_default_policy_instantiate(zval *dst) { - zval val; - - if (object_init_ex(&val, php_scylladb_retry_policy_default_policy_ce) == FAILURE) { + if (object_init_ex(dst, php_scylladb_retry_policy_default_policy_ce) == FAILURE) { return nullptr; } - ZVAL_OBJ(dst, Z_OBJ(val)); - - php_scylladb_retry_policy *obj = PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); - obj->policy = cass_retry_policy_default_new(); - return obj; + return PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); } diff --git a/src/RetryPolicy/DowngradingConsistency.c b/src/RetryPolicy/DowngradingConsistency.c index 0c1b40476..dc8a821c9 100644 --- a/src/RetryPolicy/DowngradingConsistency.c +++ b/src/RetryPolicy/DowngradingConsistency.c @@ -22,17 +22,11 @@ extern zend_object_handlers php_scylladb_retry_policy_downgrading_consistency_ha PHP_SCYLLADB_API php_scylladb_retry_policy *php_scylladb_retry_policy_downgrading_consistency_instantiate(zval *dst) { - zval val; - - if (object_init_ex(&val, php_scylladb_retry_policy_default_policy_ce) == FAILURE) { + if (object_init_ex(dst, php_scylladb_retry_policy_downgrading_consistency_ce) == FAILURE) { return nullptr; } - ZVAL_OBJ(dst, Z_OBJ(val)); - - php_scylladb_retry_policy *obj = PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); - obj->policy = cass_retry_policy_downgrading_consistency_new(); - return obj; + return PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); } void php_scylladb_retry_policy_downgrading_consistency_free(zend_object *object) diff --git a/src/RetryPolicy/Fallthrough.c b/src/RetryPolicy/Fallthrough.c index f26c0d2b9..5445237c6 100644 --- a/src/RetryPolicy/Fallthrough.c +++ b/src/RetryPolicy/Fallthrough.c @@ -30,17 +30,11 @@ extern zend_object_handlers php_scylladb_retry_policy_fallthrough_handlers; PHP_SCYLLADB_API php_scylladb_retry_policy *php_scylladb_retry_policy_fallthrough_instantiate(zval *dst) { - zval val; - - if (object_init_ex(&val, php_scylladb_retry_policy_default_policy_ce) == FAILURE) { + if (object_init_ex(dst, php_scylladb_retry_policy_fallthrough_ce) == FAILURE) { return nullptr; } - ZVAL_OBJ(dst, Z_OBJ(val)); - - php_scylladb_retry_policy *obj = PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); - obj->policy = cass_retry_policy_fallthrough_new(); - return obj; + return PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); } void php_scylladb_retry_policy_fallthrough_free(zend_object *object) diff --git a/src/RetryPolicy/Logging.c b/src/RetryPolicy/Logging.c index 69de80090..3da89f548 100644 --- a/src/RetryPolicy/Logging.c +++ b/src/RetryPolicy/Logging.c @@ -63,13 +63,13 @@ php_scylladb_retry_policy_logging_new(zend_class_entry *ce) PHP_SCYLLADB_API php_scylladb_retry_policy *php_scylladb_retry_policy_logging_instantiate(zval *dst, php_scylladb_retry_policy *retry_policy) { - zval val; - - if (object_init_ex(&val, php_scylladb_retry_policy_default_policy_ce) == FAILURE) { + if (retry_policy->policy == nullptr) { return nullptr; } - ZVAL_OBJ(dst, Z_OBJ(val)); + if (object_init_ex(dst, php_scylladb_retry_policy_logging_ce) == FAILURE) { + return nullptr; + } php_scylladb_retry_policy *obj = PHP_SCYLLADB_OBJ_FETCH(php_scylladb_retry_policy, Z_OBJ_P(dst)); obj->policy = cass_retry_policy_logging_new(retry_policy->policy);