1--TEST--
2Phar object: getContent()
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5--INI--
6phar.readonly=0
7--FILE--
8<?php
9$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
10
11$phar = new Phar($fname);
12$phar['a/b'] = 'file contents
13this works';
14$phar->addEmptyDir('hi');
15echo $phar['a/b']->getContent() . "\n";
16try {
17echo $phar['a']->getContent(), "\n";
18} catch (Exception $e) {
19echo $e->getMessage(), "\n";
20}
21try {
22echo $phar['hi']->getContent(), "\n";
23} catch (Exception $e) {
24echo $e->getMessage(), "\n";
25}
26?>
27===DONE===
28--CLEAN--
29<?php
30unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
31__halt_compiler();
32?>
33--EXPECTF--
34file contents
35this works
36Phar error: Cannot retrieve contents, "a" in phar "%sphar_oo_getcontents.phar.php" is a directory
37Phar error: Cannot retrieve contents, "hi" in phar "%sphar_oo_getcontents.phar.php" is a directory
38===DONE===
39