Skip to content

Commit

Permalink
Merge branch 'PHP-5.3' into PHP-5.4
Browse files Browse the repository at this point in the history
* PHP-5.3:
  Fix bug 61746 Failing tests in ext/standard/tests/file/windows_links/*
  • Loading branch information
weltling committed May 8, 2012
2 parents 057f471 + c12fdbd commit 87fa84a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
6 changes: 4 additions & 2 deletions ext/standard/tests/file/windows_links/bug48746.phpt
Expand Up @@ -9,15 +9,17 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
$cmd = "mklink.exe /?";
include_once __DIR__ . '/common.inc';
$cmd = "mklink /?";
$ret = @exec($cmd, $output, $return_val);
if (count($output) == 0) {
die("mklink.exe not found in PATH");
}
?>
--FILE--
<?php
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
include_once __DIR__ . '/common.inc';
$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
mkdir($dirname, 0700, true);
Expand Down
8 changes: 5 additions & 3 deletions ext/standard/tests/file/windows_links/bug48746_1.phpt
Expand Up @@ -9,15 +9,17 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
$cmd = "mklink.exe /?";
include_once __DIR__ . '/common.inc';
$cmd = "mklink /?";
$ret = @exec($cmd, $output, $return_val);
if (count($output) == 0) {
die("mklink.exe not found in PATH");
}
?>
--FILE--
<?php
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
include_once __DIR__ . '/common.inc';
$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
Expand Down Expand Up @@ -54,4 +56,4 @@ I am included.
I am included.
bool(true)
bool(true)
bool(true)
bool(true)
8 changes: 5 additions & 3 deletions ext/standard/tests/file/windows_links/bug48746_2.phpt
Expand Up @@ -9,15 +9,17 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
include_once __DIR__ . '/common.inc';
$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
unlink('mklink bug48746_tmp.lnk');
unlink('bug48746_tmp.lnk');
?>
--FILE--
<?php
$mountvol = "c:\\Windows\\System32\\mountvol.exe";
include_once __DIR__ . '/common.inc';
$mountvol = get_mountvol();
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
Expand Down Expand Up @@ -64,4 +66,4 @@ Array
[1] => ..
[2] => a.php
[3] => b.php
)
)
8 changes: 5 additions & 3 deletions ext/standard/tests/file/windows_links/bug48746_3.phpt
Expand Up @@ -9,19 +9,21 @@ Venkat Raman Don (don.raman@microsoft.com)
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
$ret = exec('junction /? 2>&1', $out);
include_once __DIR__ . '/common.inc';
$ret = exec(get_junction().' /? 2>&1', $out);
if (strpos($out[0], 'recognized')) {
die('skip. junction.exe not found in PATH.');
}

?>
--FILE--
<?php
include_once __DIR__ . '/common.inc';
$old_dir = __DIR__;
$dirname = __DIR__ . "\\mnt\\test\\directory";
exec("mkdir " . $dirname, $output, $ret_val);
chdir(__DIR__ . "\\mnt\\test");
exec("junction junction directory", $output, $ret_val);
exec(get_junction()." junction directory", $output, $ret_val);
file_put_contents("junction\\a.php", "<?php echo \"I am included.\n\" ?>");
file_put_contents("junction\\b.php", "<?php echo \"I am included.\n\" ?>");
include "junction/a.php";
Expand All @@ -45,4 +47,4 @@ Array
[1] => ..
[2] => a.php
[3] => b.php
)
)
23 changes: 23 additions & 0 deletions ext/standard/tests/file/windows_links/common.inc
@@ -0,0 +1,23 @@
<?php

function get_sysroot() {
// usually c:\\windows, but not always
return exec('echo %SYSTEMROOT%');
}

function get_junction(){
// junction.exe isn't included with Windows
// its a sysinternals tool for working with filesystem links
// see: http://technet.microsoft.com/en-us/sysinternals/bb896768

// install somewhere that is on %path% or added to %path%
return "junction.exe";
}

function get_mountvol() {
$sysroot = get_sysroot();

return "$sysroot\\System32\\mountvol.exe";
}

?>

0 comments on commit 87fa84a

Please sign in to comment.