[PECL-CVS] [pecl-networking-gearman] ci-incompatible-pointer-types: use php-config --cflags and temporarily revert #61 fix to verify CI catches it

[email protected] (Rasmus Lerdorf) Thu, 9 Apr 2026 15:54:36 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-09T11:54:26-04:00

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

use php-config --cflags and temporarily revert #61 fix to verify CI catches it

Use php-config --cflags to preserve PHP toolchain flags per review feedback.
Temporarily revert the PHP 7.x incompatible-pointer-types fix (1e94992) so we
can confirm the CI flag actually catches the error on PHP 7.x builds.

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

Changed paths:
  M  .github/workflows/ci.yml
  M  php_gearman_worker.c


Diff:

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6e8dc83..6d66a42 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,8 +19,6 @@ jobs:
         os: [ubuntu-latest, macos-latest]
         version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
         stable: [true]
-    env:
-      CFLAGS: -Werror=incompatible-pointer-types
     steps:
       - name: Setup PHP
         uses: shivammathur/setup-php@v2
@@ -42,11 +40,15 @@ jobs:
 
       - name: Configure macOS
         if: ${{ matrix.os == 'macos-latest' }}
-        run: ./configure --with-gearman=$(brew --prefix gearman)
+        run: |
+          CFLAGS="$(php-config --cflags) -Werror=incompatible-pointer-types" \
+            ./configure --with-gearman=$(brew --prefix gearman)
 
       - name: Configure Linux
         if: ${{ matrix.os == 'ubuntu-latest' }}
-        run: ./configure --with-gearman
+        run: |
+          CFLAGS="$(php-config --cflags) -Werror=incompatible-pointer-types" \
+            ./configure --with-gearman
 
       - name: Make extension
         run: make
diff --git a/php_gearman_worker.c b/php_gearman_worker.c
index bc9fbd1..9ee4ef3 100644
--- a/php_gearman_worker.c
+++ b/php_gearman_worker.c
@@ -613,10 +613,6 @@ 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;
 
@@ -626,14 +622,8 @@ 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));