1--TEST-- 2Phar: test fopen() interception 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip");?> 5<?php if (substr(phpversion(), 0, 3) == '5.2') die("skip PHP >= 5.3 required for this test");?> 6--INI-- 7phar.require_hash=1 8phar.readonly=0 9detect_unicode=0 10--FILE-- 11<?php 12Phar::interceptFileFuncs(); 13$a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage 14fclose($a); 15$a = fopen(); // this satisfies another line of code coverage 16 17$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 18$a = new Phar($fname); 19$a['index.php'] = '<?php 20$a = fopen("dir/file1.txt", "r"); 21echo fread($a, 2); 22fclose($a); 23$a = fopen("file1.txt", "r", true); 24echo fread($a, 2); 25fclose($a); 26$a = fopen("notfound.txt", "r", true); 27?>'; 28$a['dir/file1.txt'] = 'hi'; 29$a['dir/file2.txt'] = 'hi2'; 30$a['dir/file3.txt'] = 'hi3'; 31$a->setStub('<?php 32set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__); 33include "index.php"; 34__HALT_COMPILER();'); 35include $fname; 36?> 37===DONE=== 38--CLEAN-- 39<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 40--EXPECTF-- 41Warning: fopen() expects at least 2 parameters, 0 given in %sfopen.php on line %d 42hihi 43Warning: fopen(notfound.txt): failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d 44===DONE=== 45