blob: a2665421e0fee8b716b1d8364d9e8404d9d3cd11 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
--TEST--
SPL: DirectoryIterator defaults
--SKIPIF--
<?php if (!extension_loaded("spl") || !extension_loaded('reflection') || !defined('GLOB_ERR')) print "skip"; ?>
--FILE--
<?php
$classes = array(
'DirectoryIterator' => 0,
'FilesystemIterator' => 1,
'RecursiveDirectoryIterator' => 1,
'GlobIterator' => 1,
);
foreach ($classes as $class => $flags) {
echo "===$class===\n";
$ref = new ReflectionClass($class);
$obj = $ref->newInstance('glob://*');
echo get_class($obj->current()) . "\n";
if ($flags)
{
var_dump($obj->getFlags());
$flags = array(
FilesystemIterator::CURRENT_AS_FILEINFO => 0,
FilesystemIterator::CURRENT_AS_SELF => 0,
FilesystemIterator::CURRENT_AS_PATHNAME => 1,
);
foreach($flags as $flag => $isstring) {
$obj->setFlags($flag);
$obj->rewind();
var_dump($obj->getFlags());
if ($isstring) {
$val = $obj->current();
if (is_string($val)) {
var_dump(true);
} else {
var_dump($val);
}
} else {
echo get_class($obj->current()) . "\n";
}
}
}
}
?>
===DONE===
--EXPECTF--
===DirectoryIterator===
DirectoryIterator
===FilesystemIterator===
SplFileInfo
int(%d)
int(0)
SplFileInfo
int(16)
FilesystemIterator
int(32)
bool(true)
===RecursiveDirectoryIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
RecursiveDirectoryIterator
int(32)
bool(true)
===GlobIterator===
SplFileInfo
int(0)
int(0)
SplFileInfo
int(16)
GlobIterator
int(32)
bool(true)
===DONE===
|