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===DONE=== 22--CLEAN-- 23<?php 24unlink(__DIR__ . '/buildfromiterator.phar.tar'); 25__HALT_COMPILER(); 26?> 27--EXPECTF-- 28array(21) { 29 ["frontcontroller1.phar.phpt"]=> 30 string(%d) "%sfrontcontroller1.phar.phpt" 31 ["frontcontroller10.phar.phpt"]=> 32 string(%d) "%sfrontcontroller10.phar.phpt" 33 ["frontcontroller11.phar.phpt"]=> 34 string(%d) "%sfrontcontroller11.phar.phpt" 35 ["frontcontroller12.phar.phpt"]=> 36 string(%d) "%sfrontcontroller12.phar.phpt" 37 ["frontcontroller13.phar.phpt"]=> 38 string(%d) "%sfrontcontroller13.phar.phpt" 39 ["frontcontroller14.phar.phpt"]=> 40 string(%d) "%sfrontcontroller14.phar.phpt" 41 ["frontcontroller15.phar.phpt"]=> 42 string(%d) "%sfrontcontroller15.phar.phpt" 43 ["frontcontroller16.phar.phpt"]=> 44 string(%d) "%sfrontcontroller16.phar.phpt" 45 ["frontcontroller17.phar.phpt"]=> 46 string(%d) "%sfrontcontroller17.phar.phpt" 47 ["frontcontroller18.phar.phpt"]=> 48 string(%d) "%sfrontcontroller18.phar.phpt" 49 ["frontcontroller19.phar.phpt"]=> 50 string(%d) "%sfrontcontroller19.phar.phpt" 51 ["frontcontroller2.phar.phpt"]=> 52 string(%d) "%sfrontcontroller2.phar.phpt" 53 ["frontcontroller20.phar.phpt"]=> 54 string(%d) "%sfrontcontroller20.phar.phpt" 55 ["frontcontroller21.phar.phpt"]=> 56 string(%d) "%sfrontcontroller21.phar.phpt" 57 ["frontcontroller3.phar.phpt"]=> 58 string(%d) "%sfrontcontroller3.phar.phpt" 59 ["frontcontroller4.phar.phpt"]=> 60 string(%d) "%sfrontcontroller4.phar.phpt" 61 ["frontcontroller5.phar.phpt"]=> 62 string(%d) "%sfrontcontroller5.phar.phpt" 63 ["frontcontroller6.phar.phpt"]=> 64 string(%d) "%sfrontcontroller6.phar.phpt" 65 ["frontcontroller7.phar.phpt"]=> 66 string(%d) "%sfrontcontroller7.phar.phpt" 67 ["frontcontroller8.phar.phpt"]=> 68 string(%d) "%sfrontcontroller8.phar.phpt" 69 ["frontcontroller9.phar.phpt"]=> 70 string(%d) "%sfrontcontroller9.phar.phpt" 71} 72bool(true) 73===DONE=== 74