@@ -129,10 +129,27 @@ struct _zend_fiber {
129129 /* Fiber that suspended us. */
130130 zend_fiber_context * previous ;
131131
132- /* Callback and info / cache to be used when fiber is started. */
132+ /*
133+ * Callback and info / cache to be used when fiber is started.
134+ * IMPORTANT: When fiber->coroutine != NULL, these fields are NOT USED.
135+ * Instead, fiber->fcall is used (see below).
136+ * Only used for non-coroutine path (fiber->coroutine == NULL).
137+ */
133138 zend_fcall_info fci ;
134139 zend_fcall_info_cache fci_cache ;
135140
141+ /*
142+ * Pointer to allocated zend_fcall_t structure for coroutine path.
143+ * OWNERSHIP:
144+ * - Fiber allocates on creation and TEMPORARILY owns it
145+ * - coroutine_entry_point TAKES ownership (sets fiber->fcall to NULL)
146+ * - coroutine_entry_point FREES it at the end
147+ * NULL when:
148+ * - fiber->coroutine == NULL (non-coroutine path)
149+ * - Ownership already taken by coroutine_entry_point
150+ */
151+ zend_fcall_t * fcall ;
152+
136153 /* Current Zend VM execute data being run by the fiber. */
137154 zend_execute_data * execute_data ;
138155
@@ -142,7 +159,12 @@ struct _zend_fiber {
142159 /* Active fiber vm stack. */
143160 zend_vm_stack vm_stack ;
144161
145- /* Storage for fiber return value. */
162+ /*
163+ * Storage for fiber return value.
164+ * IMPORTANT: When fiber->coroutine != NULL, this field is NOT USED.
165+ * Result is stored in coroutine->result instead.
166+ * Only used for non-coroutine path (fiber->coroutine == NULL).
167+ */
146168 zval result ;
147169};
148170
0 commit comments