1--TEST-- 2Phar: tar-based phar, bzipped tar 3--SKIPIF-- 4<?php 5if (!extension_loaded("phar")) die("skip"); 6if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required"); 7if (!extension_loaded("spl")) die("skip SPL not available"); 8if (!extension_loaded("bz2")) die("skip bz2 not available"); 9?> 10--INI-- 11phar.readonly=0 12phar.require_hash=0 13--FILE-- 14<?php 15include dirname(__FILE__) . '/files/tarmaker.php.inc'; 16 17$fname = dirname(__FILE__) . '/tar_bz2.phar'; 18$alias = 'phar://' . $fname; 19$fname2 = dirname(__FILE__) . '/tar_bz2.phar.tar'; 20$alias2 = 'phar://' . $fname2; 21 22$tar = new tarmaker($fname, 'bz2'); 23$tar->init(); 24$tar->addFile('tar_004.php', '<?php var_dump(__FILE__);'); 25$tar->addFile('internal/file/here', "hi there!\n"); 26$tar->mkDir('internal/dir'); 27$tar->mkDir('dir'); 28$tar->addFile('.phar/stub.php', '<?php 29var_dump(__FILE__); 30var_dump(substr(__FILE__, 0, 4) != "phar"); 31Phar::mapPhar(); 32var_dump("it worked"); 33include "phar://" . __FILE__ . "/tar_004.php"; 34__HALT_COMPILER(); 35'); 36$tar->close(); 37 38include $alias; 39 40$phar = new Phar($fname); 41$phar['test'] = 'hi'; 42 43copy($fname, $fname2); 44 45$phar2 = new Phar($fname2); 46var_dump($phar2->isFileFormat(Phar::TAR)); 47var_dump($phar2->isCompressed() == Phar::BZ2); 48 49?> 50===DONE=== 51--CLEAN-- 52<?php 53@unlink(dirname(__FILE__) . '/tar_bz2.phar'); 54@unlink(dirname(__FILE__) . '/tar_bz2.phar.tar'); 55?> 56--EXPECTF-- 57string(%d) "%star_bz2.phar" 58bool(true) 59string(9) "it worked" 60string(%d) "phar://%star_bz2.phar/tar_004.php" 61bool(true) 62bool(true) 63===DONE=== 64