1--TEST--
2Phar::buildFromIterator() iterator, SplFileInfo as current tar-based
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7--FILE--
8<?php
9try {
10    chdir(__DIR__);
11    $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
12    $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
13    asort($a);
14    var_dump($a);
15    var_dump($phar->isFileFormat(Phar::TAR));
16} catch (Exception $e) {
17    var_dump(get_class($e));
18    echo $e->getMessage() . "\n";
19}
20?>
21--CLEAN--
22<?php
23unlink(__DIR__ . '/buildfromiterator.phar.tar');
24__HALT_COMPILER();
25?>
26--EXPECTF--
27array(21) {
28  ["frontcontroller1.phar.phpt"]=>
29  string(%d) "%sfrontcontroller1.phar.phpt"
30  ["frontcontroller10.phar.phpt"]=>
31  string(%d) "%sfrontcontroller10.phar.phpt"
32  ["frontcontroller11.phar.phpt"]=>
33  string(%d) "%sfrontcontroller11.phar.phpt"
34  ["frontcontroller12.phar.phpt"]=>
35  string(%d) "%sfrontcontroller12.phar.phpt"
36  ["frontcontroller13.phar.phpt"]=>
37  string(%d) "%sfrontcontroller13.phar.phpt"
38  ["frontcontroller14.phar.phpt"]=>
39  string(%d) "%sfrontcontroller14.phar.phpt"
40  ["frontcontroller15.phar.phpt"]=>
41  string(%d) "%sfrontcontroller15.phar.phpt"
42  ["frontcontroller16.phar.phpt"]=>
43  string(%d) "%sfrontcontroller16.phar.phpt"
44  ["frontcontroller17.phar.phpt"]=>
45  string(%d) "%sfrontcontroller17.phar.phpt"
46  ["frontcontroller18.phar.phpt"]=>
47  string(%d) "%sfrontcontroller18.phar.phpt"
48  ["frontcontroller19.phar.phpt"]=>
49  string(%d) "%sfrontcontroller19.phar.phpt"
50  ["frontcontroller2.phar.phpt"]=>
51  string(%d) "%sfrontcontroller2.phar.phpt"
52  ["frontcontroller20.phar.phpt"]=>
53  string(%d) "%sfrontcontroller20.phar.phpt"
54  ["frontcontroller21.phar.phpt"]=>
55  string(%d) "%sfrontcontroller21.phar.phpt"
56  ["frontcontroller3.phar.phpt"]=>
57  string(%d) "%sfrontcontroller3.phar.phpt"
58  ["frontcontroller4.phar.phpt"]=>
59  string(%d) "%sfrontcontroller4.phar.phpt"
60  ["frontcontroller5.phar.phpt"]=>
61  string(%d) "%sfrontcontroller5.phar.phpt"
62  ["frontcontroller6.phar.phpt"]=>
63  string(%d) "%sfrontcontroller6.phar.phpt"
64  ["frontcontroller7.phar.phpt"]=>
65  string(%d) "%sfrontcontroller7.phar.phpt"
66  ["frontcontroller8.phar.phpt"]=>
67  string(%d) "%sfrontcontroller8.phar.phpt"
68  ["frontcontroller9.phar.phpt"]=>
69  string(%d) "%sfrontcontroller9.phar.phpt"
70}
71bool(true)
72