1--TEST--
2Mkdir with path length < 260 and > 248 has be a long path
3--SKIPIF--
4<?php
5include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
6
7skip_if_not_win();
8
9$start = realpath(__DIR__);
10if (strlen($start) > 260 || strlen($start) > 248) {
11	die("skip the starting path length is unsuitable for this test");
12}
13
14?>
15--FILE--
16<?php
17
18$p = "";
19$s = str_repeat('a', 50);
20$how_many = 32;
21
22for ($i = 0; $i < $how_many; $i++) {
23	$p .= "$s\\";
24}
25
26$start = realpath(__DIR__);
27$newstart = false;
28if (strlen($start) <= 248) {
29	// create the exact length
30	$start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
31	$newstart = true;
32}
33
34var_dump($start);
35$p = $start . "\\" . $p;
36
37var_dump($p);
38var_dump(mkdir($p, 0777, true));
39var_dump(file_exists($p));
40
41$p7 = $p . "hello.txt";
42
43var_dump(file_put_contents($p7, "hello"));
44var_dump(file_get_contents($p7));
45
46// cleanup
47unlink($p7);
48for ($i = 0; $i < $how_many; $i++) {
49	$p0 = substr($p, 0, strlen($p) - $i*51);
50	rmdir($p0);
51}
52if ($newstart) {
53	rmdir($start);
54}
55
56?>
57===DONE===
58--EXPECTF--
59string(251) "%s"
60string(1884) "%s"
61bool(true)
62bool(true)
63int(5)
64string(5) "hello"
65===DONE===
66