1--TEST--
2Basic long path test with file I/O
3--SKIPIF--
4<?php
5include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
6
7skip_if_not_win();
8if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
9
10?>
11--FILE--
12<?php
13
14$p = "";
15$s = str_repeat('a', 50);
16$how_many = 32;
17
18
19for ($i = 0; $i < $how_many; $i++) {
20    $p .= "$s";
21    $p .= DIRECTORY_SEPARATOR;
22}
23
24$p = realpath(__DIR__) . DIRECTORY_SEPARATOR . $p;
25
26echo strlen($p), "\n", $p, "\n";
27
28
29var_dump(mkdir($p, 0777, true));
30var_dump(file_exists($p));
31
32$p7 = $p . "hello.txt";
33
34file_put_contents($p7, "hello");
35var_dump(file_get_contents($p7));
36
37unlink($p7);
38
39for ($i = 0; $i < $how_many; $i++) {
40    $p0 = substr($p, 0, strlen($p) - $i*51);
41    rmdir($p0);
42}
43
44var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s));
45
46?>
47--EXPECTF--
48%d%d%d%d
49%s\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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