1--TEST-- 2Phar: create and modify tar-based phar 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--INI-- 6phar.readonly=0 7--FILE-- 8<?php 9 10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php'; 11$pname = 'phar://' . $fname; 12 13@unlink($fname); 14 15file_put_contents($pname . '/a.php', "brand new!\n"); 16 17if (function_exists("opcache_get_status")) { 18 $status = opcache_get_status(); 19 if ($status["opcache_enabled"] || (isset($status["file_cache_only"]) && $status["file_cache_only"])) { 20 ini_set("opcache.revalidate_freq", "0"); 21 sleep(2); 22 } 23} 24 25$phar = new Phar($fname); 26var_dump($phar->isFileFormat(Phar::TAR)); 27$sig1 = md5_file($fname); 28 29include $pname . '/a.php'; 30 31file_put_contents($pname .'/a.php', "modified!\n"); 32file_put_contents($pname .'/b.php', "another!\n"); 33 34$phar = new Phar($fname); 35$sig2 = md5_file($fname); 36 37var_dump($sig1 != $sig2); 38 39include $pname . '/a.php'; 40include $pname . '/b.php'; 41 42?> 43===DONE=== 44--CLEAN-- 45<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?> 46--EXPECT-- 47bool(true) 48brand new! 49bool(true) 50modified! 51another! 52===DONE=== 53