xref: /PHP-5.3/ext/posix/tests/posix_access.phpt (revision 8deefa87)
1--TEST--
2Test posix_access() function test
3--DESCRIPTION--
4checks for existence, read-access, write-access, execute-access
5--CREDITS--
6Moritz Neuhaeuser, info@xcompile.net
7PHP Testfest Berlin 2009-05-10
8--SKIPIF--
9<?php
10if (!extension_loaded('posix')) {
11    die('SKIP The posix extension is not loaded.');
12}
13if (posix_geteuid() == 0) {
14    die('SKIP Cannot run test as root.');
15}
16?>
17--INI--
18safe_mode = 1
19--FILE--
20<?php
21$filename = dirname(__FILE__) . '/foo.test';
22$fp = fopen($filename,"w");
23fwrite($fp,"foo");
24fclose($fp);
25
26chmod ($filename, 0000);
27var_dump(posix_access($filename, POSIX_F_OK));
28
29chmod ($filename, 0400);
30var_dump(posix_access($filename, POSIX_R_OK));
31
32chmod ($filename, 0600);
33var_dump(posix_access($filename, POSIX_W_OK));
34
35chmod ($filename, 0700);
36var_dump(posix_access($filename, POSIX_X_OK));
37?>
38===DONE===
39--CLEAN--
40<?php
41$filename = dirname(__FILE__) . '/foo.test';
42chmod ($filename, 0700);
43unlink($filename);
44?>
45--EXPECTF--
46Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d
47bool(true)
48bool(true)
49bool(true)
50bool(true)
51===DONE===
52