1--TEST-- 2Phar: test that creation of zip-based phar generates valid zip with all bells/whistles 3--EXTENSIONS-- 4phar 5zlib 6bz2 7--INI-- 8phar.readonly=0 9--FILE-- 10<?php 11 12$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; 13$pname = 'phar://' . $fname; 14$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar.zip.php'; 15$pname2 = 'phar://' . $fname2; 16 17$phar = new Phar($fname); 18 19$phar->setMetadata('hi there'); 20$phar['a'] = 'hi'; 21$phar['a']->setMetadata('a meta'); 22$phar['b'] = 'hi2'; 23$phar['b']->compress(Phar::GZ); 24$phar['c'] = 'hi3'; 25$phar['c']->compress(Phar::BZ2); 26$phar['b']->chmod(0444); 27$phar->setStub("<?php ok __HALT_COMPILER();"); 28$phar->setAlias("hime"); 29unset($phar); 30copy($fname, $fname2); 31Phar::unlinkArchive($fname); 32var_dump(file_exists($fname), file_exists($pname . '/a')); 33 34$phar = new Phar($fname2); 35var_dump($phar['a']->getContent(), $phar['b']->getContent(), $phar['c']->getContent()); 36var_dump($phar['a']->isCompressed(), $phar['b']->isCompressed() == Phar::GZ, $phar['c']->isCompressed() == Phar::BZ2); 37var_dump((string) decoct(fileperms($pname2 . '/b'))); 38var_dump($phar->getStub()); 39var_dump($phar->getAlias()); 40var_dump($phar->getMetadata()); 41var_dump($phar['a']->getMetadata()); 42?> 43--CLEAN-- 44<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?> 45<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip.php'); ?> 46--EXPECT-- 47bool(false) 48bool(false) 49string(2) "hi" 50string(3) "hi2" 51string(3) "hi3" 52bool(false) 53bool(true) 54bool(true) 55string(6) "100444" 56string(32) "<?php ok __HALT_COMPILER(); ?> 57" 58string(4) "hime" 59string(8) "hi there" 60string(6) "a meta" 61