summaryrefslogtreecommitdiff
path: root/ext/standard/tests/dir/bug72625.phpt
blob: b64010fcd4f1ccae4fc7cf9cf99b50e660e43d1c (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
--TEST--
Bug #72625 realpath() fails on very long argument.
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
  die("skip Valid only on Windows");
}
?>
--FILE--
<?php

$base = sys_get_temp_dir() . "/" . md5(uniqid());
while (strlen($base) < 260) {
	$base = "$base/" . md5(uniqid());
}

$f0 = "$base/_test/documents/projects/myproject/vendor/name/library/classpath";
$f1 = "$f0/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath";


mkdir($f0, 0777, true);


var_dump(
	$f0,
	file_exists($f0),
	realpath($f0),
	dirname($f0),

	$f1,
	file_exists($f1),
	realpath($f1),
	dirname($f1)
);

$tmp = $f0;
while ($tmp > $base) {
	rmdir($tmp);
	$tmp = dirname($tmp);
}

?>
===DONE===
--EXPECTF--
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath"
bool(true)
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath/../../../../../../../../_test/documents/projects/myproject/vendor/name/library/../../../../../../../_test/documents/projects/myproject/vendor/name/library/classpath"
bool(true)
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
===DONE===