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);
