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 pre-unicode version of PHP 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__); 24if (version_compare(PHP_VERSION, "5.3", "<")) { 25Phar::interceptFileFuncs(); 26} 27include "phar://" . __FILE__ . "/a"; 28__HALT_COMPILER();'); 29include $pname; 30?> 31===DONE=== 32--CLEAN-- 33<?php 34unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); 35__HALT_COMPILER(); 36?> 37--EXPECTF-- 38bool(true) 39string(%d) "%sphar_magic.phar.zip.php" 40bool(true) 41in b 42<?php include "b/c.php"; 43in d 44===DONE=== 45