Commit c94d7911ab1 for php

commit c94d7911ab1946a9c096b0937d1646e8165cbb13
Author: Gina Peter Banyard <girgias@php.net>
Date:   Thu Oct 1 08:09:06 2026 +0100

    Zend: add zend_object_copy() API

    Closes GH-24036

diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index fa905cb1e53..08f23f690fb 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -35,6 +35,9 @@ PHP 8.7 INTERNALS UPGRADE NOTES
   This new signature covers the most common parameters used with zend_is_callable_ex().
 - Removed zend_hrtime_posix_clock_id. zend_hrtime() always uses CLOCK_MONOTONIC
   on POSIX platforms.
+- Added a new zend_object_copy() function which increases the refcount of
+  a zend_object* and returns it. Allowing more descriptive code rather than
+  doing an assignment followed by GC_ADDREF().

 ========================
 2. Build system changes
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index 434ac4499e7..b66a3d307e5 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -70,6 +70,13 @@ static zend_always_inline void zend_object_store_ctor_failed(zend_object *obj)

 END_EXTERN_C()

+/** Increase the refcount and return the input */
+static zend_always_inline zend_object *zend_object_copy(zend_object *obj)
+{
+	GC_ADDREF(obj);
+	return obj;
+}
+
 static zend_always_inline void zend_object_release(zend_object *obj)
 {
 	if (GC_DELREF(obj) == 0) {