1--TEST-- 2Phar: include/fopen magic zip-based 3--SKIPIF-- 4<?php 5if (!extension_loaded("phar")) die("skip"); 6if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip Unicode support required"); 7?> 8--INI-- 9phar.require_hash=0 10phar.readonly=0 11--FILE-- 12<?php 13$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; 14$pname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; 15$p = new Phar($fname); 16var_dump($p->isFileFormat(Phar::ZIP)); 17$p['a'] = '<?php include "b/c.php";' . "\n"; 18$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";'; 19$p['d'] = "in d\n"; 20$p->setStub('<?php 21var_dump(__FILE__); 22var_dump(substr(__FILE__, 0, 4) != "phar"); 23set_include_path("phar://" . __FILE__); 24include "phar://" . __FILE__ . "/a"; 25__HALT_COMPILER();'); 26include $pname; 27?> 28===DONE=== 29--CLEAN-- 30<?php 31unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); 32__HALT_COMPILER(); 33?> 34--EXPECTF-- 35bool(true) 36unicode(%d) "%sphar_magicU.phar.zip.php" 37bool(true) 38in b 39<?php include "b/c.php"; 40in d 41===DONE=== 42