1--TEST--
2Test lchown() function : error functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
6if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
7require __DIR__ . '/../skipif_root.inc';
8?>
9--FILE--
10<?php
11echo "*** Testing lchown() : error functionality ***\n";
12
13// Set up
14$filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown.txt';
15touch( $filename );
16$uid = posix_getuid();
17
18// Non-existent filename
19var_dump( lchown( 'foobar_lchown.txt', $uid ) );
20
21// Bad user
22var_dump( lchown( $filename, -5 ) );
23
24?>
25--CLEAN--
26<?php
27
28$filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown.txt';
29unlink($filename);
30
31?>
32--EXPECTF--
33*** Testing lchown() : error functionality ***
34
35Warning: lchown(): No such file or directory in %s on line %d
36bool(false)
37
38Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d
39bool(false)
40