[PECL-CVS] [pecl-networking-gearman] bug61: fixes #61
[email protected] (Rasmus Lerdorf) Tue, 7 Apr 2026 12:17:29 +0000
| Newsgroups | php.pecl.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-07T08:17:19-04:00
Commit: https://github.com/php/pecl-networking-gearman/commit/1e949925d3a3555570fb785983ca7869999a2b38
Raw diff: https://github.com/php/pecl-networking-gearman/commit/1e949925d3a3555570fb785983ca7869999a2b38.diff
fixes #61
Changed paths:
M php_gearman_worker.c
Diff:
diff --git a/php_gearman_worker.c b/php_gearman_worker.c
index 342035e..bc9fbd1 100644
--- a/php_gearman_worker.c
+++ b/php_gearman_worker.c
@@ -613,6 +613,9 @@ 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;
@@ -623,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));