1--TEST--
2Phar: create and modify zip-based 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
8--FILE--
9<?php
10
11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
12$pname = 'phar://' . $fname;
13
14@unlink($fname);
15
16file_put_contents($pname . '/a.php', "brand new!\n");
17
18$phar = new Phar($fname);
19var_dump($phar->isFileFormat(Phar::ZIP));
20$sig1 = md5_file($fname);
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 = md5_file($fname);
29
30var_dump($sig1 != $sig2);
31
32include $pname . '/a.php';
33include $pname . '/b.php';
34
35?>
36===DONE===
37--CLEAN--
38<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
39--EXPECTF--
40bool(true)
41brand new!
42bool(true)
43modified!
44another!
45===DONE===
46