git: 9f7b56df2aad - main - devel/pecl-APCu: Fix build with PHP 8.6
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Jul 2026 12:23:25 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=9f7b56df2aada052238329611734e2cafaba4507
commit 9f7b56df2aada052238329611734e2cafaba4507
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2026-07-11 11:46:28 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2026-07-11 12:20:57 +0000
devel/pecl-APCu: Fix build with PHP 8.6
Obtained from: https://github.com/krakjoe/apcu/commit/d29e907791502af89a7996930f8dce5fd8efe4a1
https://github.com/krakjoe/apcu/commit/95f9ab828f95c6ca5877e584ead109189d0cec61
---
devel/pecl-APCu/Makefile | 1 -
devel/pecl-APCu/files/patch-php86 | 77 +++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/devel/pecl-APCu/Makefile b/devel/pecl-APCu/Makefile
index 0cba7fe47aaf..e5366597f4b1 100644
--- a/devel/pecl-APCu/Makefile
+++ b/devel/pecl-APCu/Makefile
@@ -12,7 +12,6 @@ LICENSE= PHP301
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= localbase php:pecl
-IGNORE_WITH_PHP= 86
PHP_MODNAME= apcu
diff --git a/devel/pecl-APCu/files/patch-php86 b/devel/pecl-APCu/files/patch-php86
new file mode 100644
index 000000000000..b6da479ea131
--- /dev/null
+++ b/devel/pecl-APCu/files/patch-php86
@@ -0,0 +1,77 @@
+Obtained from: https://github.com/krakjoe/apcu/commit/d29e907791502af89a7996930f8dce5fd8efe4a1
+ https://github.com/krakjoe/apcu/commit/95f9ab828f95c6ca5877e584ead109189d0cec61
+
+--- apc_cache.h.orig 2025-12-07 07:58:53 UTC
++++ apc_cache.h
+@@ -300,7 +300,7 @@ static inline void apc_cache_runlock(apc_cache_t *cach
+ }
+
+ /* APC_ENTRY_SIZE takes into account the trailing key-string + terminating 0-byte */
+-#define APC_ENTRY_SIZE(key_len) (ZEND_MM_ALIGNED_SIZE(XtOffsetOf(apc_cache_entry_t, key.val) + key_len + 1))
++#define APC_ENTRY_SIZE(key_len) (ZEND_MM_ALIGNED_SIZE(offsetof(apc_cache_entry_t, key.val) + key_len + 1))
+
+ /* ENTRYAT and ENTRYOF are used to convert between offsets and pointers to cache entries.
+ * Both expect the presence of cache->header that points to the cache header in the
+--- apc_iterator.c.orig 2025-12-07 07:58:53 UTC
++++ apc_iterator.c
+@@ -548,7 +548,7 @@ int apc_iterator_init(int module_number) {
+
+ apc_iterator_object_handlers.clone_obj = NULL;
+ apc_iterator_object_handlers.free_obj = apc_iterator_free;
+- apc_iterator_object_handlers.offset = XtOffsetOf(apc_iterator_t, obj);
++ apc_iterator_object_handlers.offset = offsetof(apc_iterator_t, obj);
+
+ return SUCCESS;
+ }
+--- apc_iterator.h.orig 2025-12-07 07:58:53 UTC
++++ apc_iterator.h
+@@ -69,7 +69,7 @@ typedef struct _apc_iterator_t {
+ zend_object obj;
+ } apc_iterator_t;
+
+-#define apc_iterator_fetch_from(o) ((apc_iterator_t*)((char*)o - XtOffsetOf(apc_iterator_t, obj)))
++#define apc_iterator_fetch_from(o) ((apc_iterator_t*)((char*)o - offsetof(apc_iterator_t, obj)))
+ #define apc_iterator_fetch(z) apc_iterator_fetch_from(Z_OBJ_P(z))
+
+ typedef struct _apc_iterator_item_t {
+--- apc_persist.c.orig 2025-12-07 07:58:53 UTC
++++ apc_persist.c
+@@ -244,7 +244,8 @@ static zend_bool apc_persist_calc_zval(apc_persist_con
+ case IS_RESOURCE:
+ apc_warning("Cannot store resources in apcu cache");
+ return 0;
+- EMPTY_SWITCH_DEFAULT_CASE()
++ default:
++ ZEND_UNREACHABLE();
+ }
+ }
+
+@@ -450,7 +451,8 @@ static void apc_persist_copy_zval_impl(apc_persist_con
+ if (!ptr) ptr = apc_persist_copy_ref(ctxt, Z_REF_P(zv));
+ ZVAL_REF(zv, ptr);
+ return;
+- EMPTY_SWITCH_DEFAULT_CASE()
++ default:
++ ZEND_UNREACHABLE();
+ }
+ }
+
+--- apc.h.orig 2025-12-07 07:58:53 UTC
++++ apc.h
+@@ -67,6 +67,16 @@
+ #include "php.h"
+ #include "main/php_streams.h"
+
++/* ZEND_UNREACHABLE() was added in PHP 8.0. Provide fallback for PHP 7.x.
++ * Remove this block when APCu drops support for PHP < 8.0. */
++#if PHP_VERSION_ID < 80000
++# if ZEND_DEBUG
++# define ZEND_UNREACHABLE() do {ZEND_ASSERT(0); ZEND_ASSUME(0);} while (0)
++# else
++# define ZEND_UNREACHABLE() ZEND_ASSUME(0)
++# endif
++#endif
++
+ /* console display functions */
+ PHP_APCU_API void apc_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
+ PHP_APCU_API void apc_warning(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);