1--TEST-- 2Phar::buildFromIterator() iterator, 1 file resource passed in 3--EXTENSIONS-- 4phar 5--INI-- 6phar.require_hash=0 7phar.readonly=0 8--FILE-- 9<?php 10class myIterator implements Iterator 11{ 12 var $a; 13 function __construct(array $a) 14 { 15 $this->a = $a; 16 } 17 function next(): void { 18 echo "next\n"; 19 next($this->a); 20 } 21 function current(): mixed { 22 echo "current\n"; 23 return current($this->a); 24 } 25 function key(): mixed { 26 echo "key\n"; 27 return key($this->a); 28 } 29 function valid(): bool { 30 echo "valid\n"; 31 return is_resource(current($this->a)); 32 } 33 function rewind(): void { 34 echo "rewind\n"; 35 reset($this->a); 36 } 37} 38chdir(__DIR__); 39$phar = new Phar(__DIR__ . '/buildfromiterator9.phar'); 40var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r'))))); 41fclose($a); 42?> 43--CLEAN-- 44<?php 45unlink(__DIR__ . '/buildfromiterator9.phar'); 46?> 47--EXPECTF-- 48rewind 49valid 50current 51key 52next 53valid 54array(1) { 55 ["a"]=> 56 string(%d) "[stream]" 57} 58