summaryrefslogtreecommitdiff
path: root/ext/phar/tests/zf_test.phpt
blob: b3d1e4cb9a58be13e18e4b633142e0b9df3146c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
Phar: test broken app
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
<?php if (!extension_loaded("zlib")) die("skip zlib not available"); ?>
--INI--
phar.readonly=0
phar.require_hash=0
--FILE--
<?php

$file = "zfapp";
$orig_file = __DIR__ . "/files/$file.tgz";
$tgz_file = __DIR__ . "/$file.tgz";
$phar_file = __DIR__ . "/$file.phar.tar.gz";
copy($orig_file, $tgz_file);

$phar = new PharData($tgz_file);
$phar = $phar->convertToExecutable();

$phar = new Phar($phar_file);
$phar->startBuffering();
$phar->setStub("<?php
Phar::interceptFileFuncs();
Phar::webPhar('$file.phar', 'html/index.php');
echo 'BlogApp is intended to be executed from a web browser\n';
exit -1;
__HALT_COMPILER();
");
$phar->stopBuffering();

foreach(new RecursiveIteratorIterator($phar) as $path) {
    echo str_replace('\\', '/', $path->getPathName()) . "\n";
}

?>
===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/zfapp.tgz');
unlink(__DIR__ . '/zfapp.phar.tar.gz');
?>
--EXPECTF--
phar://%szfapp.phar.tar.gz/application/default/controllers/ErrorController.php
phar://%szfapp.phar.tar.gz/application/default/controllers/IndexController.php
phar://%szfapp.phar.tar.gz/application/default/views/scripts/error/error.phtml
phar://%szfapp.phar.tar.gz/application/default/views/scripts/index/index.phtml
phar://%szfapp.phar.tar.gz/html/.htaccess
phar://%szfapp.phar.tar.gz/html/index.php
===DONE===