1--TEST--
2Phar object: getContent()
3--EXTENSIONS--
4phar
5--INI--
6phar.readonly=0
7--FILE--
8<?php
9$fname = __DIR__ . '/' . 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--CLEAN--
28<?php
29unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
30__halt_compiler();
31?>
32--EXPECTF--
33file contents
34this works
35phar error: Cannot retrieve contents, "a" in phar "%sphar_oo_getcontents.phar.php" is a directory
36phar error: Cannot retrieve contents, "hi" in phar "%sphar_oo_getcontents.phar.php" is a directory
37