global statement removal: hphp/test/zend [2/x]
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / file / fopen_variation7.php
blob9e668bfcc0a659d61dc5af98040c3b8db0be8af8
1 <?php
2 /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
3 * Description: Open a file or a URL and return a file pointer
4 * Source code: ext/standard/file.c
5 * Alias to functions:
6 */
8 require_once('fopen_include_path.inc');
10 $thisTestDir = basename(__FILE__, ".php") . ".dir";
11 mkdir($thisTestDir);
12 chdir($thisTestDir);
14 $newpath = create_include_path();
15 set_include_path($newpath);
16 runtest();
17 $newpath = generate_next_path();
18 set_include_path($newpath);
19 runtest();
21 teardown_include_path();
22 restore_include_path();
23 chdir("..");
24 rmdir($thisTestDir);
26 function runtest() {
28 $tmpfile = basename(__FILE__, ".php") . ".tmp";
29 $h = fopen($tmpfile, "w", true);
30 fwrite($h, (binary)"This is the test file");
31 fclose($h);
34 $h = @fopen($tmpfile, "r");
35 if ($h === false) {
36 echo "Not created in working dir\n";
38 else {
39 echo "created in working dir\n";
40 fclose($h);
41 unlink($tmpfile);
44 $h = @fopen(ZendGoodExtStandardTestsFileFopenVariation7::$dir1.'/'.$tmpfile, "r");
45 if ($h === false) {
46 echo "Not created in dir1\n";
48 else {
49 echo "created in dir1\n";
50 fclose($h);
51 unlink(ZendGoodExtStandardTestsFileFopenVariation7::$dir1.'/'.$tmpfile);
55 abstract final class ZendGoodExtStandardTestsFileFopenVariation7 {
56 public static $dir1;
59 ===DONE===