[php-src] Issue #25404: Missing zend_return_unwrap_ref() calls trigger assertion failures:

From: Date: Wed, 11 Nov 2026 20:34:49 +0000
Subject: [php-src] Issue #25404: Missing zend_return_unwrap_ref() calls trigger assertion failures:
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-254128@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/25404 Author: DanielEScherzer The following cases trigger assertion failures, tested on latest 8.6 dev (0dbc4a7953a8aca38d0cf04fa4fb4ac076f00419) ``` php: Zend/zend_vm_execute.h:2167: const zend_op *ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER(zend_execute_data *, const zend_op *): Assertion `((call->func->common.fn_flags & (1 << 12)) && !zend_return_should_unwrap_ref(call)) ? (zval_get_type(&(*(ret))) == 10) : !(zval_get_type(&(*(ret))) == 10)' failed. Aborted (core dumped) ``` <details> <summary>RecursiveIteratorIterator::callHasChildren()</summary> ```php <?php class Demo implements RecursiveIterator { public bool $v = true; public function getChildren(): ?RecursiveIterator { return null; } public function &hasChildren(): bool { return $this->v; } public function current(): mixed { return null; } public function key(): mixed { return null; } public function next(): void {} public function rewind(): void {} public function valid(): bool { return true; } } $r = new RecursiveIteratorIterator(new Demo()); var_dump($r->callHasChildren()); ``` </details> <details> <summary>RecursiveIteratorIterator::callGetChildren()</summary> ```php <?php class Demo implements RecursiveIterator { public mixed $v = null; public function &getChildren(): ?RecursiveIterator { return $this->v; } public function hasChildren(): bool { return true; } public function current(): mixed { return null; } public function key(): mixed { return null; } public function next(): void {} public function rewind(): void {} public function valid(): bool { return true; } } $r = new RecursiveIteratorIterator(new Demo()); var_dump($r->callGetChildren()); ``` </details> <details> <summary>RecursiveFilterIterator::hasChildren()</summary> ```php <?php class ConcreteRecursiveFilterIterator extends RecursiveFilterIterator { public function accept(): bool { return true; } } class Demo implements RecursiveIterator { public bool $v = true; public function getChildren(): ?RecursiveIterator { return null; } public function &hasChildren(): bool { return $this->v; } public function current(): mixed { return null; } public function key(): mixed { return null; } public function next(): void {} public function rewind(): void {} public function valid(): bool { return true; } } $r = new ConcreteRecursiveFilterIterator(new Demo()); var_dump($r->hasChildren()); ``` </details> <details> <summary>zend_call_method() from zend_test</summary> ```php <?php class Demo { public mixed $v = true; public function &returnsRef() { return $this->v; } } $d = new Demo(); var_dump(zend_call_method($d, 'returnsRef')); ``` </details> Cross-link #20628

« previous php.bugs (#254128) next »