Description
Originally reported by @flex0geek.
The following code:
<?php
class FreeSelfOnRewind implements Iterator {
public function __construct(private MultipleIterator $parent) {}
public function rewind(): void {
$this->parent->detachIterator($this);
var_dump($this);
}
public function current(): mixed { return 0; }
public function key(): mixed { return 0; }
public function next(): void {}
public function valid(): bool { return false; }
}
$mi = new MultipleIterator();
$mi->attachIterator(new FreeSelfOnRewind($mi));
$mi->rewind();
Resulted in this output:
The same goes for various other MultipleIterator methods that call methods on the child iterator without addref.
PHP Version
Operating System
No response
Description
Originally reported by @flex0geek.
The following code:
Resulted in this output:
The same goes for various other
MultipleIteratormethods that call methods on the child iterator without addref.PHP Version
Operating System
No response