1--TEST--
2Mkdir with path length < 260 and > 248 has be a long path
3--SKIPIF--
4<?php
5include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc";
6
7skip_if_not_win();
8
9$start = realpath(dirname(__FILE__));
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(dirname(__FILE__));
27if (strlen($start) <= 248) {
28	// create the exact length
29	$start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
30}
31
32var_dump($start);
33$p = $start . "\\" . $p;
34
35var_dump($p);
36var_dump(mkdir($p, 0777, true));
37var_dump(file_exists($p));
38
39$p7 = $p . "hello.txt";
40
41var_dump(file_put_contents($p7, "hello"));
42var_dump(file_get_contents($p7));
43
44// cleanup
45unlink($p7);
46for ($i = 0; $i < $how_many; $i++) {
47	$p0 = substr($p, 0, strlen($p) - $i*51);
48	rmdir($p0);
49}
50
51?>
52===DONE===
53--EXPECTF--
54string(251) "%s"
55string(1884) "%s"
56bool(true)
57bool(true)
58int(5)
59string(5) "hello"
60===DONE===
61