1--TEST-- 2Phar::convertToPhar() from tar 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.require_hash=0 7phar.readonly=0 8--FILE-- 9<?php 10 11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar'; 12$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar'; 13$fname3 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.3.phar'; 14 15$phar = new Phar($fname); 16$phar['a.txt'] = 'some text'; 17$phar->stopBuffering(); 18var_dump($phar->isFileFormat(Phar::TAR)); 19var_dump(strlen($phar->getStub())); 20 21$phar = $phar->convertToExecutable(Phar::TAR); 22var_dump($phar->isFileFormat(Phar::TAR)); 23var_dump($phar->getStub()); 24 25$phar['a'] = 'hi there'; 26 27$phar = $phar->convertToExecutable(Phar::PHAR, Phar::NONE, '.3.phar'); 28var_dump($phar->isFileFormat(Phar::PHAR)); 29var_dump(strlen($phar->getStub())); 30 31copy($fname3, $fname2); 32 33$phar = new Phar($fname2); 34var_dump($phar->isFileFormat(Phar::PHAR)); 35var_dump(strlen($phar->getStub())); 36 37?> 38===DONE=== 39--CLEAN-- 40<?php 41unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); 42unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); 43unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.tar'); 44unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar'); 45unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.3.phar'); 46__HALT_COMPILER(); 47?> 48--EXPECT-- 49bool(false) 50int(6683) 51bool(true) 52string(60) "<?php // tar-based phar archive stub file 53__HALT_COMPILER();" 54bool(true) 55int(6683) 56bool(true) 57int(6683) 58===DONE=== 59