PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 27 lines | 27 code | 0 blank | 0 comment | 0 complexity | 310f5f4063bcf1c1e05e0b54a4c0ab71 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. $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
  3. $a = new Phar($fname);
  4. $a['index.php'] = '<?php
  5. $a = opendir("dir");
  6. if ($a) {
  7. while (false !== ($e = readdir($a))) {
  8. echo $e;
  9. }
  10. }
  11. ?>';
  12. $a['dir/file1.txt'] = 'hi';
  13. $a['dir/file2.txt'] = 'hi2';
  14. $a['dir/file3.txt'] = 'hi3';
  15. $a->setStub('<?php
  16. Phar::interceptFileFuncs();
  17. set_include_path("phar://" . __FILE__);
  18. include "index.php";
  19. __HALT_COMPILER();');
  20. include $fname;
  21. echo "\n";
  22. opendir('phar://');
  23. opendir('phar://hi.phar');
  24. ?>
  25. ===DONE===
  26. <?php error_reporting(0); ?>
  27. <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php'); ?>