1--TEST-- 2Phar: PharFileInfo::__construct 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'; 10$pname = 'phar://' . $fname; 11 12try { 13file_put_contents($fname, 'blah'); 14$a = new PharFileInfo($pname . '/oops'); 15} catch (Exception $e) { 16echo $e->getMessage() . "\n"; 17unlink($fname); 18} 19 20try { 21$a = new PharFileInfo(array()); 22} catch (TypeError $e) { 23echo $e->getMessage() . "\n"; 24} 25 26$a = new Phar($fname); 27$a['a'] = 'hi'; 28$b = $a['a']; 29 30try { 31$a = new PharFileInfo($pname . '/oops/I/do/not/exist'); 32} catch (Exception $e) { 33echo $e->getMessage() . "\n"; 34} 35 36try { 37$b->__construct('oops'); 38} catch (Exception $e) { 39echo $e->getMessage() . "\n"; 40} 41 42try { 43$a = new PharFileInfo(__FILE__); 44} catch (Exception $e) { 45echo $e->getMessage() . "\n"; 46} 47?> 48===DONE=== 49--CLEAN-- 50<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?> 51--EXPECTF-- 52Cannot open phar file 'phar://%spharfileinfo_construct.phar/oops': internal corruption of phar "%spharfileinfo_construct.phar" (truncated entry) 53PharFileInfo::__construct() expects parameter 1 to be a valid path, array given 54Cannot access phar file entry '%s' in archive '%s' 55Cannot call constructor twice 56'%s' is not a valid phar archive URL (must have at least phar://filename.phar) 57===DONE=== 58