1--TEST-- 2Phar::buildFromIterator() RegexIterator(DirectoryIterator), SplFileInfo as current 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__ . '/buildfromiterator8.phar'); 12 $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR); 13 asort($a); 14 var_dump($a); 15} catch (Exception $e) { 16 var_dump(get_class($e)); 17 echo $e->getMessage() . "\n"; 18} 19?> 20===DONE=== 21--CLEAN-- 22<?php 23unlink(__DIR__ . '/buildfromiterator8.phar'); 24__HALT_COMPILER(); 25?> 26--EXPECTF-- 27array(33) { 28 ["001.phpt"]=> 29 string(%d) "%s001.phpt" 30 ["002.phpt"]=> 31 string(%d) "%s002.phpt" 32 ["003.phpt"]=> 33 string(%d) "%s003.phpt" 34 ["004.phpt"]=> 35 string(%d) "%s004.phpt" 36 ["005.phpt"]=> 37 string(%d) "%s005.phpt" 38 ["006.phpt"]=> 39 string(%d) "%s006.phpt" 40 ["007.phpt"]=> 41 string(%d) "%s007.phpt" 42 ["008.phpt"]=> 43 string(%d) "%s008.phpt" 44 ["009.phpt"]=> 45 string(%d) "%s009.phpt" 46 ["010.phpt"]=> 47 string(%d) "%s010.phpt" 48 ["011.phpt"]=> 49 string(%d) "%s011.phpt" 50 ["012.phpt"]=> 51 string(%d) "%s012.phpt" 52 ["013.phpt"]=> 53 string(%d) "%s013.phpt" 54 ["014.phpt"]=> 55 string(%d) "%s014.phpt" 56 ["015.phpt"]=> 57 string(%d) "%s015.phpt" 58 ["016.phpt"]=> 59 string(%d) "%s016.phpt" 60 ["017.phpt"]=> 61 string(%d) "%s017.phpt" 62 ["018.phpt"]=> 63 string(%d) "%s018.phpt" 64 ["019.phpt"]=> 65 string(%d) "%s019.phpt" 66 ["020.phpt"]=> 67 string(%d) "%s020.phpt" 68 ["021.phpt"]=> 69 string(%d) "%s021.phpt" 70 ["022.phpt"]=> 71 string(%d) "%s022.phpt" 72 ["023.phpt"]=> 73 string(%d) "%s023.phpt" 74 ["024.phpt"]=> 75 string(%d) "%s024.phpt" 76 ["025.phpt"]=> 77 string(%d) "%s025.phpt" 78 ["026.phpt"]=> 79 string(%d) "%s026.phpt" 80 ["027.phpt"]=> 81 string(%d) "%s027.phpt" 82 ["028.phpt"]=> 83 string(%d) "%s028.phpt" 84 ["029.phpt"]=> 85 string(%d) "%s029.phpt" 86 ["030.phpt"]=> 87 string(%d) "%s030.phpt" 88 ["031.phpt"]=> 89 string(%d) "%s031.phpt" 90 ["032.phpt"]=> 91 string(%d) "%s032.phpt" 92 ["033.phpt"]=> 93 string(%d) "%s033.phpt" 94} 95===DONE=== 96