blob: 9e8b74594bd366b692a979b5f527a447d311e41c (
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
|
--TEST--
Test is_file() function: usage variations - invalid filenames
--CONFLICTS--
obscure_filename
--FILE--
<?php
/* Testing is_file() with invalid arguments -int, float, bool, NULL */
function flatten($variable) {
\ob_start();
\var_dump($variable);
$flattened =
\ob_get_contents();
\ob_end_clean();
return \trim($flattened);
}
foreach([
/* Invalid filenames */
-2.34555,
" ",
"",
true,
false,
null,
/* scalars */
1234,
0
] as $filename ) {
printf(
"%s: %d\n",
flatten($filename), @is_file($filename));
clearstatcache();
}
?>
--EXPECT--
float(-2.34555): 0
string(1) " ": 0
string(0) "": 0
bool(true): 0
bool(false): 0
NULL: 0
int(1234): 0
int(0): 0
|