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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
--TEST--
SPL: SplFileInfo cloning
--FILE--
<?php
function test($name, $lc, $lp)
{
static $i = 0;
echo "===$i===\n";
$i++;
$o = new SplFileInfo($name);
var_dump($o);
$c = clone $o;
var_dump($c);
var_dump($o === $c);
var_dump($o == $c);
var_dump($o->getPathname() == $c->getPathname());
$f = new SplFileObject($name);
var_dump($name);
var_dump($f->getPathName());
$l = substr($f->getPathName(), -1);
var_dump($l != '/' && $l != '\\' && $l == $lc);
var_dump($f->getFileName());
$l = substr($f->getFileName(), -1);
var_dump($l != '/' && $l != '\\' && $l == $lc);
var_dump($f->getPath());
$l = substr($f->getPath(), -1);
var_dump($l != '/' && $l != '\\' && $l == $lp);
$fo = $o->openFile();
var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
}
test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't', substr(dirname(__FILE__),-1));
test(dirname(__FILE__) . '/', substr(dirname(__FILE__),-1), 'l');
test(dirname(__FILE__), substr(dirname(__FILE__),-1), 'l');
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===0===
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "fileobject_001a.txt"
}
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "fileobject_001a.txt"
}
bool(false)
bool(true)
bool(true)
%s(%d) "%sfileobject_001a.txt"
unicode(%d) "%sfileobject_001a.txt"
bool(true)
unicode(19) "fileobject_001a.txt"
bool(true)
string(%d) "%stests"
bool(true)
unicode(%d) "%sfileobject_001a.txt"
unicode(19) "fileobject_001a.txt"
unicode(%d) "%stests"
===1===
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s%etests"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "tests"
}
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "tests"
}
bool(false)
bool(true)
bool(true)
%s(%d) "%stests/"
unicode(%d) "%stests"
bool(true)
unicode(5) "tests"
bool(true)
string(%d) "%sspl"
bool(true)
unicode(%d) "%stests"
unicode(%d) "tests"
unicode(%d) "%s%espl"
===2===
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "%s"
}
object(SplFileInfo)#%d (2) {
[u"pathName":u"SplFileInfo":private]=>
unicode(%d) "%s%etests"
[u"fileName":u"SplFileInfo":private]=>
unicode(%d) "%s"
}
bool(false)
bool(true)
bool(true)
%s(%d) "%stests"
unicode(%d) "%stests"
bool(true)
unicode(%d) "tests"
bool(true)
string(%d) "%sspl"
bool(true)
unicode(%d) "%stests"
unicode(5) "tests"
unicode(%d) "%sspl"
===DONE===
|