1--TEST-- 2Phar: create and modify phar 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> 6--INI-- 7phar.readonly=0 8phar.require_hash=1 9--FILE-- 10<?php 11 12$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 13$pname = 'phar://' . $fname; 14 15@unlink($fname); 16 17file_put_contents($pname . '/a.php', "brand new!\n"); 18 19$phar = new Phar($fname); 20$sig1 = $phar->getSignature(); 21 22include $pname . '/a.php'; 23 24file_put_contents($pname .'/a.php', "modified!\n"); 25file_put_contents($pname .'/b.php', "another!\n"); 26 27$phar = new Phar($fname); 28$sig2 = $phar->getSignature(); 29 30var_dump($sig1[b'hash']); 31var_dump($sig2[b'hash']); 32var_dump($sig1[b'hash'] != $sig2[b'hash']); 33 34include $pname . '/a.php'; 35include $pname . '/b.php'; 36 37?> 38===DONE=== 39--CLEAN-- 40<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 41--EXPECTF-- 42brand new! 43string(40) "%s" 44string(40) "%s" 45bool(true) 46modified! 47another! 48===DONE=== 49