blob: 1502d62e02286a7073b11d780945227e9a107d51 (
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
|
--TEST--
Mkdir with path length < 260 and > 248 has be a long path
--SKIPIF--
<?php
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
skip_if_not_win();
$start = realpath(__DIR__);
if (strlen($start) > 260 || strlen($start) > 248) {
die("skip the starting path length is unsuitable for this test");
}
?>
--FILE--
<?php
$p = "";
$s = str_repeat('a', 50);
$how_many = 32;
for ($i = 0; $i < $how_many; $i++) {
$p .= "$s\\";
}
$start = realpath(__DIR__);
$newstart = false;
if (strlen($start) <= 248) {
// create the exact length
$start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
$newstart = true;
}
var_dump($start);
$p = $start . "\\" . $p;
var_dump($p);
var_dump(mkdir($p, 0777, true));
var_dump(file_exists($p));
$p7 = $p . "hello.txt";
var_dump(file_put_contents($p7, "hello"));
var_dump(file_get_contents($p7));
// cleanup
unlink($p7);
for ($i = 0; $i < $how_many; $i++) {
$p0 = substr($p, 0, strlen($p) - $i*51);
rmdir($p0);
}
if ($newstart) {
rmdir($start);
}
?>
--EXPECTF--
string(251) "%s"
string(1884) "%s"
bool(true)
bool(true)
int(5)
string(5) "hello"
|