PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/phar/tests/fopen.php

http://github.com/facebook/hiphop-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
  1. <?php
  2. Phar::interceptFileFuncs();
  3. $a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage
  4. fclose($a);
  5. $a = fopen(); // this satisfies another line of code coverage
  6. $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
  7. $a = new Phar($fname);
  8. $a['index.php'] = '<?php
  9. $a = fopen("dir/file1.txt", "r");
  10. echo fread($a, 2);
  11. fclose($a);
  12. $a = fopen("file1.txt", "r", true);
  13. echo fread($a, 2);
  14. fclose($a);
  15. $a = fopen("notfound.txt", "r", true);
  16. ?>';
  17. $a['dir/file1.txt'] = 'hi';
  18. $a['dir/file2.txt'] = 'hi2';
  19. $a['dir/file3.txt'] = 'hi3';
  20. $a->setStub('<?php
  21. set_include_path("phar://" . __FILE__ . "/dir" . PATH_SEPARATOR . "phar://" . __FILE__);
  22. include "index.php";
  23. __HALT_COMPILER();');
  24. include $fname;
  25. ?>
  26. ===DONE===
  27. <?php error_reporting(0); ?>
  28. <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'); ?>