1--TEST--
2Phar: PharFileInfo::getCRC32
3--EXTENSIONS--
4phar
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 length 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--CLEAN--
43<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
44--EXPECTF--
45Phar entry is a directory, does not have a CRC
46Phar entry was not CRC checked
47int(%s)
48