1--TEST-- 2Phar::compressFiles(Phar::BZ2) zip format 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5<?php if (!extension_loaded("bz2")) die("skip bz2 not present"); ?> 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===DONE=== 46--CLEAN-- 47<?php 48unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); 49unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); 50?> 51--EXPECT-- 52string(1) "a" 53bool(false) 54string(1) "b" 55bool(false) 56string(1) "c" 57bool(false) 58string(1) "a" 59bool(false) 60bool(true) 61string(1) "b" 62bool(false) 63bool(true) 64string(1) "c" 65bool(false) 66bool(true) 67string(1) "a" 68bool(false) 69bool(true) 70===DONE=== 71