readfile_variation6.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Test readfile() function : variation - test include path
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --FILE--
  6. <?php
  7. /* Prototype : int readfile(string filename [, bool use_include_path[, resource context]])
  8. * Description: Output a file or a URL
  9. * Source code: ext/standard/file.c
  10. * Alias to functions:
  11. */
  12. require_once('fopen_include_path.inc');
  13. echo "*** Testing readfile() : variation ***\n";
  14. // this doesn't create the include dirs in this directory
  15. // we change to this to ensure we are not part of the
  16. // include paths.
  17. $thisTestDir = "readfileVar6.dir";
  18. mkdir($thisTestDir);
  19. chdir($thisTestDir);
  20. $filename = "afile.txt";
  21. $secondFile = $dir2."/".$filename;
  22. $newpath = create_include_path();
  23. set_include_path($newpath);
  24. runtest();
  25. teardown_include_path();
  26. restore_include_path();
  27. chdir("..");
  28. rmdir($thisTestDir);
  29. function runtest() {
  30. global $secondFile, $filename;
  31. $h = fopen($secondFile, "w");
  32. fwrite($h, "File in include path");
  33. fclose($h);
  34. readfile($filename, true);
  35. echo "\n";
  36. unlink($secondFile);
  37. }
  38. ?>
  39. ===DONE===
  40. --EXPECT--
  41. *** Testing readfile() : variation ***
  42. File in include path
  43. ===DONE===