1--TEST-- 2Phar::convertToPhar() from tar 3--EXTENSIONS-- 4phar 5--INI-- 6phar.require_hash=0 7phar.readonly=0 8--FILE-- 9<?php 10 11$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar'; 12$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.2.phar'; 13$fname3 = __DIR__ . '/' . 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--CLEAN-- 39<?php 40unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); 41unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); 42unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); 43unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar'); 44unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.3.phar'); 45__HALT_COMPILER(); 46?> 47--EXPECT-- 48bool(false) 49int(6641) 50bool(true) 51string(60) "<?php // tar-based phar archive stub file 52__HALT_COMPILER();" 53bool(true) 54int(6641) 55bool(true) 56int(6641) 57