summaryrefslogtreecommitdiff
path: root/ext/standard/tests/dir/scandir_error1-win32-mb.phpt
blob: 6c1ce72a445e469c4a3b2a2c11d861c0438531a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--TEST--
Test scandir() function : error conditions - Incorrect number of args
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
  die("skip Valid only on Windows");
}
?>
--FILE--
<?php
/* Prototype  : array scandir(string $dir [, int $sorting_order [, resource $context]])
 * Description: List files & directories inside the specified path 
 * Source code: ext/standard/dir.c
 */

/*
 * Pass incorrect number of arguments to scandir() to test behaviour
 */

echo "*** Testing scandir() : error conditions ***\n";

// Zero arguments
echo "\n-- Testing scandir() function with Zero arguments --\n";
var_dump( scandir() );

//Test scandir with one more than the expected number of arguments
echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_error';
mkdir($dir);
$sorting_order = 10;
$context = stream_context_create();
$extra_arg = 10;
var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
?>
===DONE===
--CLEAN--
<?php
$directory = dirname(__FILE__) . '/私はガラスを食べられますscandir_error';
rmdir($directory);
?>
--EXPECTF--
*** Testing scandir() : error conditions ***

-- Testing scandir() function with Zero arguments --

Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
NULL

-- Testing scandir() function with more than expected no. of arguments --

Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
NULL
===DONE===