1--TEST--
2Test rmdir() function : usage variation - invalid filenames
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) != "WIN")
8  die("skip Only valid for Windows");
9?>
10--FILE--
11<?php
12/* Prototype  : bool rmdir(string dirname[, resource context])
13 * Description: Remove a directory
14 * Source code: ext/standard/file.c
15 * Alias to functions:
16 */
17
18echo "*** Testing rmdir() : usage variation ***\n";
19
20// Define error handler
21function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
22	if (error_reporting() != 0) {
23		// report non-silenced errors
24		echo "Error: $err_no - $err_msg, $filename($linenum)\n";
25	}
26}
27set_error_handler('test_error_handler');
28
29//get an unset variable
30$unset_var = 10;
31unset ($unset_var);
32
33// define some classes
34class classWithToString
35{
36	public function __toString() {
37		return "Class A object";
38	}
39}
40
41class classWithoutToString
42{
43}
44
45// heredoc string
46$heredoc = <<<EOT
47hello world
48EOT;
49
50// add arrays
51$index_array = array (1, 2, 3);
52$assoc_array = array ('one' => 1, 'two' => 2);
53
54//array of values to iterate over
55$inputs = array(
56
57      // null data
58      'uppercase NULL' => NULL,
59      'lowercase null' => null,
60
61      // boolean data
62      'lowercase false' =>false,
63      'uppercase FALSE' =>FALSE,
64
65      // empty data
66      'empty string DQ' => "",
67      'empty string SQ' => '',
68
69      // undefined data
70      'undefined var' => @$undefined_var,
71
72      // unset data
73      'unset var' => @$unset_var,
74
75      // other
76      // php outputs Permission Denied, p8 outputs no suck file or dir
77      'single space' => ' ',
78);
79
80// loop through each element of the array for dirname
81
82foreach($inputs as $key =>$value) {
83      echo "\n--$key--\n";
84      var_dump( rmdir($value) );
85};
86
87?>
88===DONE===
89--EXPECTF--
90*** Testing rmdir() : usage variation ***
91
92--uppercase NULL--
93Error: 2 - rmdir(): %s, %s(%d)
94bool(false)
95
96--lowercase null--
97Error: 2 - rmdir(): %s, %s(%d)
98bool(false)
99
100--lowercase false--
101Error: 2 - rmdir(): %s, %s(%d)
102bool(false)
103
104--uppercase FALSE--
105Error: 2 - rmdir(): %s, %s(%d)
106bool(false)
107
108--empty string DQ--
109Error: 2 - rmdir(): %s, %s(%d)
110bool(false)
111
112--empty string SQ--
113Error: 2 - rmdir(): %s, %s(%d)
114bool(false)
115
116--undefined var--
117Error: 2 - rmdir(): %s, %s(%d)
118bool(false)
119
120--unset var--
121Error: 2 - rmdir(): %s, %s(%d)
122bool(false)
123
124--single space--
125Error: 2 - rmdir( ): %s, %s(%d)
126bool(false)
127===DONE===
128