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} 16if (PHP_VERSION_ID < 503099) { 17 die('SKIP Safe mode is no longer available.'); 18} 19?> 20--FILE-- 21<?php 22$filename = dirname(__FILE__) . '/foo.test'; 23$fp = fopen($filename,"w"); 24fwrite($fp,"foo"); 25fclose($fp); 26 27chmod ($filename, 0000); 28var_dump(posix_access($filename, POSIX_F_OK)); 29 30chmod ($filename, 0400); 31var_dump(posix_access($filename, POSIX_R_OK)); 32 33chmod ($filename, 0600); 34var_dump(posix_access($filename, POSIX_W_OK)); 35 36chmod ($filename, 0700); 37var_dump(posix_access($filename, POSIX_X_OK)); 38?> 39===DONE=== 40--CLEAN-- 41<?php 42$filename = dirname(__FILE__) . '/foo.test'; 43chmod ($filename, 0700); 44unlink($filename); 45?> 46--EXPECTF-- 47Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in %s on line %d 48bool(true) 49bool(true) 50bool(true) 51bool(true) 52===DONE=== 53