Merge branch 'PHP-7.4'

* PHP-7.4:
  Extract test helper function for SeCreateSymbolicLinkPrivilege check
This commit is contained in:
Christoph M. Becker 2020-07-02 12:24:49 +02:00
commit 66a5f9fb18
6 changed files with 16 additions and 34 deletions

View file

@ -3,12 +3,8 @@ Bug #68825 (Exception in DirectoryIterator::getLinkTarget())
--SKIPIF-- --SKIPIF--
<?php <?php
if (PHP_OS_FAMILY === 'Windows') { if (PHP_OS_FAMILY === 'Windows') {
$fn = "bug68825.lnk"; include_once __DIR__ . '/../../standard/tests/file/windows_links/common.inc';
$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out); skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
@unlink($fn);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
} }
?> ?>
--FILE-- --FILE--

View file

@ -7,16 +7,8 @@ Venkat Raman Don
if(substr(PHP_OS, 0, 3) != 'WIN' ) { if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test'); die('skip windows only test');
} }
if(PHP_WINDOWS_VERSION_MAJOR < 6) { include_once __DIR__ . '/windows_links/common.inc';
die('skip windows version 6.0+ only test'); skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
}
$fn = "bug47767.lnk";
$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out);
@unlink($fn);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -3,13 +3,8 @@ Test rename() function: usage variations-6
--SKIPIF-- --SKIPIF--
<?php <?php
if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows');
if (!function_exists("symlink")) die("skip symlinks are not supported"); include_once __DIR__ . '/windows_links/common.inc';
$fn = "rename_variation6tmp.lnk"; skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out);
@unlink($fn);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -8,11 +8,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test'); die('skip windows only test');
} }
include_once __DIR__ . '/common.inc'; include_once __DIR__ . '/common.inc';
$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out); skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
unlink('bug48746_tmp.lnk');
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -6,11 +6,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test'); die('skip windows only test');
} }
include_once __DIR__ . '/common.inc'; include_once __DIR__ . '/common.inc';
$ret = exec('mklink bug73962_tmp.lnk ' . __FILE__ .' 2>&1', $out); skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(__FILE__);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
unlink('bug73962_tmp.lnk');
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -20,4 +20,11 @@ function get_mountvol() {
return "$sysroot\\System32\\mountvol.exe"; return "$sysroot\\System32\\mountvol.exe";
} }
?> function skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(string $filename) {
$ln = "$filename.lnk";
$ret = exec("mklink $ln " . __FILE__ .' 2>&1', $out);
@unlink($ln);
if (strpos($ret, 'privilege') !== false) {
die('skip SeCreateSymbolicLinkPrivilege not enabled');
}
}