xref: /PHP-7.1/ext/phar/tests/zf_test.phpt (revision 4f9daeed)
1--TEST--
2Phar: test broken app
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
6--INI--
7phar.readonly=0
8phar.require_hash=0
9--FILE--
10<?php
11
12$file = "zfapp";
13$orig_file = dirname(__FILE__) . "/files/$file.tgz";
14$tgz_file = dirname(__FILE__) . "/$file.tgz";
15$phar_file = dirname(__FILE__) . "/$file.phar.tar.gz";
16copy($orig_file, $tgz_file);
17
18$phar = new PharData($tgz_file);
19$phar = $phar->convertToExecutable();
20
21$phar = new Phar($phar_file);
22$phar->startBuffering();
23$phar->setStub("<?php
24Phar::interceptFileFuncs();
25Phar::webPhar('$file.phar', 'html/index.php');
26echo 'BlogApp is intended to be executed from a web browser\n';
27exit -1;
28__HALT_COMPILER();
29");
30$phar->stopBuffering();
31
32foreach(new RecursiveIteratorIterator($phar) as $path) {
33    echo str_replace('\\', '/', $path->getPathName()) . "\n";
34}
35
36?>
37===DONE===
38--CLEAN--
39<?php
40unlink(dirname(__FILE__) . '/zfapp.tgz');
41unlink(dirname(__FILE__) . '/zfapp.phar.tar.gz');
42?>
43--EXPECTF--
44phar://%szfapp.phar.tar.gz/application/default/controllers/ErrorController.php
45phar://%szfapp.phar.tar.gz/application/default/controllers/IndexController.php
46phar://%szfapp.phar.tar.gz/application/default/views/scripts/error/error.phtml
47phar://%szfapp.phar.tar.gz/application/default/views/scripts/index/index.phtml
48phar://%szfapp.phar.tar.gz/html/.htaccess
49phar://%szfapp.phar.tar.gz/html/index.php
50===DONE===
51