1--TEST-- 2Phar: test edge cases of fopen() function interception #2 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5<?php if (version_compare(phpversion(), '6.0', '>=')) die('skip parameter parsing changed in 6.0'); ?> 6--INI-- 7phar.readonly=0 8--FILE-- 9<?php 10Phar::interceptFileFuncs(); 11$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 12$pname = 'phar://' . $fname; 13 14fopen(array(), 'r'); 15chdir(dirname(__FILE__)); 16file_put_contents($fname, b"blah\n"); 17file_put_contents("foob", b"test\n"); 18$a = fopen($fname, 'rb'); 19echo fread($a, 1000); 20fclose($a); 21unlink($fname); 22mkdir($pname . '/oops'); 23file_put_contents($pname . '/foo/hi', b'<?php 24$context = stream_context_create(); 25$a = fopen("foob", "rb", false, $context); 26echo fread($a, 1000); 27fclose($a); 28fopen("../oops", "r"); 29?> 30'); 31include $pname . '/foo/hi'; 32?> 33===DONE=== 34--CLEAN-- 35<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 36<?php rmdir(dirname(__FILE__) . '/poo'); ?> 37<?php unlink(dirname(__FILE__) . '/foob'); ?> 38--EXPECTF-- 39Warning: fopen() expects parameter 1 to be a valid path, array given in %sfopen_edgecases2.php on line %d 40blah 41test 42 43Warning: fopen(phar://%sfopen_edgecases2.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2.phar.php/foo/hi on line %d 44===DONE=== 45