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