1--TEST--
2Phar::buildFromIterator() iterator, file can't be opened zip-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
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() {
18        echo "next\n";
19        return next($this->a);
20    }
21    function current() {
22        echo "current\n";
23        return current($this->a);
24    }
25    function key() {
26        echo "key\n";
27        return key($this->a);
28    }
29    function valid() {
30        echo "valid\n";
31        return current($this->a);
32    }
33    function rewind() {
34        echo "rewind\n";
35        return reset($this->a);
36    }
37}
38try {
39    chdir(__DIR__);
40    $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
41    var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
42} catch (Exception $e) {
43    var_dump(get_class($e));
44    echo $e->getMessage() . "\n";
45}
46?>
47--CLEAN--
48<?php
49unlink(__DIR__ . '/buildfromiterator.phar.zip');
50__HALT_COMPILER();
51?>
52--EXPECTF--
53rewind
54valid
55current
56key
57%s(24) "UnexpectedValueException"
58Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
59