1--TEST--
2Phar: PharFileInfo::getCRC32
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.require_hash=0
7phar.readonly=0
8--FILE--
9<?php
10$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar';
11$pname = 'phar://' . $fname;
12$file = "<?php
13Phar::mapPhar('hio');
14__HALT_COMPILER(); ?>";
15
16// compressed file length does not match incompressed lentgh for an uncompressed file
17
18$files = array();
19$files['a/subdir/here'] = array('cont'=>'a','ulen'=>1,'clen'=>1);
20include 'files/phar_test.inc';
21
22$b = new PharFileInfo($pname . '/a/subdir');
23try {
24var_dump($b->getCRC32());
25} catch (Exception $e) {
26echo $e->getMessage() . "\n";
27}
28
29$b = new PharFileInfo($pname . '/a/subdir/here');
30try {
31var_dump($b->getCRC32());
32} catch (Exception $e) {
33echo $e->getMessage() . "\n";
34}
35$a = file_get_contents($pname . '/a/subdir/here');
36try {
37var_dump($b->getCRC32());
38} catch (Exception $e) {
39echo $e->getMessage() . "\n";
40}
41?>
42===DONE===
43--CLEAN--
44<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
45--EXPECTF--
46Phar entry is a directory, does not have a CRC
47Phar entry was not CRC checked
48int(%s)
49===DONE===
50