1--TEST-- 2Phar::compressFiles(Phar::BZ2) zip format 3--EXTENSIONS-- 4phar 5bz2 6--INI-- 7phar.readonly=0 8--FILE-- 9<?php 10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; 11$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip'; 12$pname = 'phar://' . $fname; 13$pname2 = 'phar://' . $fname2; 14 15$phar = new Phar($fname); 16$phar['a'] = 'a'; 17$phar['b'] = 'b'; 18$phar['c'] = 'c'; 19 20var_dump(file_get_contents($pname . '/a')); 21var_dump($phar['a']->isCompressed()); 22var_dump(file_get_contents($pname . '/b')); 23var_dump($phar['b']->isCompressed()); 24var_dump(file_get_contents($pname . '/c')); 25var_dump($phar['c']->isCompressed()); 26 27$phar->compressFiles(Phar::BZ2); 28var_dump(file_get_contents($pname . '/a')); 29var_dump($phar['a']->isCompressed(Phar::GZ)); 30var_dump($phar['a']->isCompressed(Phar::BZ2)); 31var_dump(file_get_contents($pname . '/b')); 32var_dump($phar['b']->isCompressed(Phar::GZ)); 33var_dump($phar['b']->isCompressed(Phar::BZ2)); 34var_dump(file_get_contents($pname . '/c')); 35var_dump($phar['c']->isCompressed(Phar::GZ)); 36var_dump($phar['b']->isCompressed(Phar::BZ2)); 37$phar['d'] = 'hi'; // increases code coverage by having ufp open 38copy($fname, $fname2); 39$c = new Phar($fname2); 40var_dump(file_get_contents($pname2 . '/a')); 41var_dump($c['a']->isCompressed(Phar::GZ)); 42var_dump($c['a']->isCompressed(Phar::BZ2)); 43 44?> 45--CLEAN-- 46<?php 47unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); 48unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); 49?> 50--EXPECT-- 51string(1) "a" 52bool(false) 53string(1) "b" 54bool(false) 55string(1) "c" 56bool(false) 57string(1) "a" 58bool(false) 59bool(true) 60string(1) "b" 61bool(false) 62bool(true) 63string(1) "c" 64bool(false) 65bool(true) 66string(1) "a" 67bool(false) 68bool(true) 69