[PECL-CVS] [pecl-networking-gearman] ci-incompatible-pointer-types: restore PHP 7.x incompatible-pointer-types fix

[email protected] (Rasmus Lerdorf) Thu, 9 Apr 2026 19:44:38 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-09T15:44:35-04:00

Commit: https://github.com/php/pecl-networking-gearman/commit/ce8923bf2dbef3f51d7d772905b158949c9d8155
Raw diff: https://github.com/php/pecl-networking-gearman/commit/ce8923bf2dbef3f51d7d772905b158949c9d8155.diff

restore PHP 7.x incompatible-pointer-types fix

Re-apply the #61 fix now that CI has confirmed the -Werror flag catches it.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

Changed paths:
  M  php_gearman_worker.c


Diff:

diff --git a/php_gearman_worker.c b/php_gearman_worker.c
index 9ee4ef3..bc9fbd1 100644
--- a/php_gearman_worker.c
+++ b/php_gearman_worker.c
@@ -613,6 +613,10 @@ static void *_php_worker_function_callback(gearman_job_st *job,
         if (EG(exception)) {
                 zend_string *exc_msg;
                 zval rv;
+#if PHP_VERSION_ID < 80000
+                zval exception_zv;
+#endif
+
                 ZVAL_UNDEF(&rv);
                 *ret_ptr = GEARMAN_WORK_EXCEPTION;
 
@@ -622,8 +626,14 @@ static void *_php_worker_function_callback(gearman_job_st *job,
                  * class as scope so the protected message property is
                  * accessible for all Throwable types (Error, TypeError,
                  * etc.), not just Exception. See issue #21. */
+#if PHP_VERSION_ID < 80000
+                ZVAL_OBJ(&exception_zv, EG(exception));
+                exc_msg = zval_get_string(zend_read_property(
+                        EG(exception)->ce, &exception_zv, "message", sizeof("message") - 1, 1, &rv));
+#else
                 exc_msg = zval_get_string(zend_read_property(
                         EG(exception)->ce, EG(exception), "message", sizeof("message") - 1, 1, &rv));
+#endif
 
                 jobj->ret = gearman_job_send_exception(jobj->job, ZSTR_VAL(exc_msg), ZSTR_LEN(exc_msg));