Annotation of embedaddon/php/ext/posix/tests/posix_access_error_modes.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test posix_access() function test error conditions
! 3: --DESCRIPTION--
! 4: checks if posix_access() failes for wrong permissions
! 5: --CREDITS--
! 6: Moritz Neuhaeuser, info@xcompile.net
! 7: PHP Testfest Berlin 2009-05-10
! 8: --SKIPIF--
! 9: <?php
! 10: if (!extension_loaded('posix')) {
! 11: die('SKIP The posix extension is not loaded.');
! 12: }
! 13: if (posix_geteuid() == 0) {
! 14: die('SKIP Cannot run test as root.');
! 15: }
! 16: ?>
! 17: --INI--
! 18: safe_mode = 1
! 19: --FILE--
! 20: <?php
! 21: $filename = dirname(__FILE__) . '/foo.test';
! 22: var_dump(posix_access($filename, POSIX_F_OK));
! 23: $fp = fopen($filename,"w");
! 24: fwrite($fp,"foo");
! 25: fclose($fp);
! 26:
! 27: chmod ($filename, 0000);
! 28: var_dump(posix_access($filename, POSIX_R_OK));
! 29: var_dump(posix_access($filename, POSIX_W_OK));
! 30: var_dump(posix_access($filename, POSIX_X_OK));
! 31: ?>
! 32: ===DONE===
! 33: --CLEAN--
! 34: <?php
! 35: $filename = dirname(__FILE__) . '/foo.test';
! 36: chmod ($filename, 0700);
! 37: unlink($filename);
! 38: ?>
! 39: --EXPECTF--
! 40: Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line %d
! 41: bool(false)
! 42: bool(false)
! 43: bool(false)
! 44: bool(false)
! 45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>