1--TEST-- 2Phar: test edge cases of readfile() function interception 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip");?> 5--INI-- 6phar.readonly=0 7--FILE-- 8<?php 9Phar::interceptFileFuncs(); 10$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'; 11$pname = 'phar://' . $fname; 12 13readfile(array()); 14chdir(dirname(__FILE__)); 15file_put_contents($fname, "blah\n"); 16file_put_contents("foob", "test\n"); 17readfile($fname); 18unlink($fname); 19mkdir($pname . '/oops'); 20file_put_contents($pname . '/foo/hi', '<?php 21readfile("foo/" . basename(__FILE__)); 22$context = stream_context_create(); 23readfile("foob"); 24set_include_path("' . addslashes(dirname(__FILE__)) . '"); 25readfile("foob", true); 26readfile("./hi", 0, $context); 27readfile("../oops"); 28?> 29'); 30include $pname . '/foo/hi'; 31?> 32===DONE=== 33--CLEAN-- 34<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> 35<?php rmdir(dirname(__FILE__) . '/poo'); ?> 36<?php unlink(dirname(__FILE__) . '/foob'); ?> 37--EXPECTF-- 38Warning: readfile() expects parameter 1 to be a valid path, array given in %sreadfile_edgecases.php on line %d 39blah 40<?php 41readfile("foo/" . basename(__FILE__)); 42$context = stream_context_create(); 43readfile("foob"); 44set_include_path("%stests"); 45readfile("foob", true); 46readfile("./hi", 0, $context); 47readfile("../oops"); 48?> 49test 50test 51<?php 52readfile("foo/" . basename(__FILE__)); 53$context = stream_context_create(); 54readfile("foob"); 55set_include_path("%stests"); 56readfile("foob", true); 57readfile("./hi", 0, $context); 58readfile("../oops"); 59?> 60 61Warning: readfile(phar://%sreadfile_edgecases.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sreadfile_edgecases.phar.php/foo/hi on line %d 62===DONE=== 63