/hphp/test/zend/bad/ext/phar/tests/fopen.php
PHP | 29 lines | 28 code | 1 blank | 0 comment | 0 complexity | c71131af8b0310c397848fef9f439df9 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- Phar::interceptFileFuncs();
- $a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage
- fclose($a);
- $a = fopen(); // this satisfies another line of code coverage
- $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
- $a = new Phar($fname);
- $a['index.php'] = '<?php
- $a = fopen("dir/file1.txt", "r");
- echo fread($a, 2);
- fclose($a);
- $a = fopen("file1.txt", "r", true);
- echo fread($a, 2);
- fclose($a);
- $a = fopen("notfound.txt", "r", true);
- ?>';
- $a['dir/file1.txt'] = 'hi';
- $a['dir/file2.txt'] = 'hi2';
- $a['dir/file3.txt'] = 'hi3';
- $a->setStub('<?php
- set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__);
- include "index.php";
- __HALT_COMPILER();');
- include $fname;
- ?>
- ===DONE===
- <?php error_reporting(0); ?>
- <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'); ?>