mirror of
https://github.com/php/php-src.git
synced 2024-09-27 04:47:22 +00:00
af5e2eaf8d
* pull-request/320: this is test 5 not 6 fix race condition more shared names that create race conditions change to a unique filename more shared filenames yet another shared filename don't share a filename to stop race conditions fix race condition for 2-4 and normalize names for others fix race condition when running tests in parallel clean up after test Fix #64572: Clean up after the test Fix #64572: Clean up after the test
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
--TEST--
|
|
Test lchown() function : basic functionality
|
|
--SKIPIF--
|
|
<?php
|
|
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
|
|
if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
/* Prototype : bool lchown (string filename, mixed user)
|
|
* Description: Change file owner of a symlink
|
|
* Source code: ext/standard/filestat.c
|
|
* Alias to functions:
|
|
*/
|
|
|
|
echo "*** Testing lchown() : basic functionality ***\n";
|
|
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic.txt';
|
|
$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic_symlink.txt';
|
|
|
|
$uid = posix_getuid();
|
|
|
|
var_dump( touch( $filename ) );
|
|
var_dump( symlink( $filename, $symlink ) );
|
|
var_dump( lchown( $filename, $uid ) );
|
|
var_dump( fileowner( $symlink ) === $uid );
|
|
|
|
?>
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
|
|
$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic.txt';
|
|
$symlink = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown_basic_symlink.txt';
|
|
unlink($filename);
|
|
unlink($symlink);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing lchown() : basic functionality ***
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
===DONE===
|