Skip to content

Commit c12fdbd

Browse files
Matt Fickenweltling
authored andcommitted
Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*
Fixed that again for systems having their %SYSTEMROOT% not in c:\windows
1 parent 838b4b8 commit c12fdbd

File tree

5 files changed

+42
-11
lines changed

5 files changed

+42
-11
lines changed

ext/standard/tests/file/windows_links/bug48746.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ Venkat Raman Don ([email protected])
99
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
1010
die('skip windows only test');
1111
}
12-
$cmd = "mklink.exe /?";
12+
include_once __DIR__ . '/common.inc';
13+
$cmd = "mklink /?";
1314
$ret = @exec($cmd, $output, $return_val);
1415
if (count($output) == 0) {
1516
die("mklink.exe not found in PATH");
1617
}
1718
?>
1819
--FILE--
1920
<?php
20-
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
21+
include_once __DIR__ . '/common.inc';
22+
$mountvol = get_mountvol();
2123
$old_dir = __DIR__;
2224
$dirname = __DIR__ . "\\mnt\\test\\directory";
2325
mkdir($dirname, 0700, true);

ext/standard/tests/file/windows_links/bug48746_1.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ Venkat Raman Don ([email protected])
99
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
1010
die('skip windows only test');
1111
}
12-
$cmd = "mklink.exe /?";
12+
include_once __DIR__ . '/common.inc';
13+
$cmd = "mklink /?";
1314
$ret = @exec($cmd, $output, $return_val);
1415
if (count($output) == 0) {
1516
die("mklink.exe not found in PATH");
1617
}
1718
?>
1819
--FILE--
1920
<?php
20-
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
21+
include_once __DIR__ . '/common.inc';
22+
$mountvol = get_mountvol();
2123
$old_dir = __DIR__;
2224
$dirname = __DIR__ . "\\mnt\\test\\directory";
2325
exec("mkdir " . $dirname, $output, $ret_val);
@@ -54,4 +56,4 @@ I am included.
5456
I am included.
5557
bool(true)
5658
bool(true)
57-
bool(true)
59+
bool(true)

ext/standard/tests/file/windows_links/bug48746_2.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ Venkat Raman Don ([email protected])
99
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
1010
die('skip windows only test');
1111
}
12+
include_once __DIR__ . '/common.inc';
1213
$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
1314
if (strpos($ret, 'privilege')) {
1415
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
1516
}
16-
unlink('mklink bug48746_tmp.lnk');
17+
unlink('bug48746_tmp.lnk');
1718
?>
1819
--FILE--
1920
<?php
20-
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
21+
include_once __DIR__ . '/common.inc';
22+
$mountvol = get_mountvol();
2123
$old_dir = __DIR__;
2224
$dirname = __DIR__ . "\\mnt\\test\\directory";
2325
exec("mkdir " . $dirname, $output, $ret_val);
@@ -64,4 +66,4 @@ Array
6466
[1] => ..
6567
[2] => a.php
6668
[3] => b.php
67-
)
69+
)

ext/standard/tests/file/windows_links/bug48746_3.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ Venkat Raman Don ([email protected])
99
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
1010
die('skip windows only test');
1111
}
12-
$ret = exec('junction /? 2>&1', $out);
12+
include_once __DIR__ . '/common.inc';
13+
$ret = exec(get_junction().' /? 2>&1', $out);
1314
if (strpos($out[0], 'recognized')) {
1415
die('skip. junction.exe not found in PATH.');
1516
}
1617

1718
?>
1819
--FILE--
1920
<?php
21+
include_once __DIR__ . '/common.inc';
2022
$old_dir = __DIR__;
2123
$dirname = __DIR__ . "\\mnt\\test\\directory";
2224
exec("mkdir " . $dirname, $output, $ret_val);
2325
chdir(__DIR__ . "\\mnt\\test");
24-
exec("junction junction directory", $output, $ret_val);
26+
exec(get_junction()." junction directory", $output, $ret_val);
2527
file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
2628
file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
2729
include "junction/a.php";
@@ -45,4 +47,4 @@ Array
4547
[1] => ..
4648
[2] => a.php
4749
[3] => b.php
48-
)
50+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
function get_sysroot() {
4+
// usually c:\\windows, but not always
5+
return exec('echo %SYSTEMROOT%');
6+
}
7+
8+
function get_junction(){
9+
// junction.exe isn't included with Windows
10+
// its a sysinternals tool for working with filesystem links
11+
// see: http://technet.microsoft.com/en-us/sysinternals/bb896768
12+
13+
// install somewhere that is on %path% or added to %path%
14+
return "junction.exe";
15+
}
16+
17+
function get_mountvol() {
18+
$sysroot = get_sysroot();
19+
20+
return "$sysroot\\System32\\mountvol.exe";
21+
}
22+
23+
?>

0 commit comments

Comments
 (0)