import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-dir / opendir_variation1-win32.php
blobc2f15521d6450df49ef9bb69beb1e157706adef8
1 <?php
2 /* Prototype : mixed opendir(string $path[, resource $context])
3 * Description: Open a directory and return a dir_handle
4 * Source code: ext/standard/dir.c
5 */
7 /*
8 * Pass different data types as $path argument to opendir() to test behaviour
9 * Where possible, an existing directory has been entered as a string value
12 echo "*** Testing opendir() : usage variations ***\n";
14 // create directory to be passed as string value where possible
15 $path = dirname(__FILE__) . "/opendir_variation1";
16 mkdir($path);
18 //get an unset variable
19 $unset_var = 10;
20 unset ($unset_var);
22 // get a class
23 class classA {
25 var $path;
26 function __construct($path) {
27 $this->path = $path;
29 public function __toString() {
30 return $this->path;
34 // heredoc string
35 $heredoc = <<<EOT
36 $path
37 EOT;
39 // get a resource variable
40 $fp = fopen(__FILE__, "r");
42 // unexpected values to be passed to $path argument
43 $inputs = array(
45 // int data
46 /*1*/ 0,
48 12345,
49 -2345,
51 // float data
52 /*5*/ 10.5,
53 -10.5,
54 12.3456789000e10,
55 12.3456789000E-10,
56 .5,
58 // null data
59 /*10*/ NULL,
60 null,
62 // boolean data
63 /*12*/ true,
64 false,
65 TRUE,
66 FALSE,
68 // empty data
69 /*16*/ "",
70 '',
71 array(),
73 // string data
74 /*19*/ "$path",
75 'string',
76 $heredoc,
78 // object data
79 /*22*/ new classA($path),
81 // undefined data
82 /*23*/ @$undefined_var,
84 // unset data
85 /*24*/ @$unset_var,
87 // resource variable
88 /*25*/ $fp
91 // loop through each element of $inputs to check the behavior of opendir()
92 $iterator = 1;
93 foreach($inputs as $input) {
94 echo "\n-- Iteration $iterator --\n";
95 var_dump( $dh = opendir($input) );
96 if ($dh) {
97 closedir($dh);
99 $iterator++;
102 fclose($fp);
104 ===DONE===<?php
105 $path = dirname(__FILE__) . "/opendir_variation1";
106 rmdir($path);