From: Zoe Slattery Date: Thu, 14 Jun 2007 15:40:06 +0000 (+0000) Subject: Tests are not valid if run by root - adding check to skip is user is root. X-Git-Tag: php-5.2.4RC1~351 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c73237b7b9d5a54256a64f2ca09577cb82e80554;p=php Tests are not valid if run by root - adding check to skip is user is root. --- diff --git a/ext/standard/tests/file/is_executable_basic.phpt b/ext/standard/tests/file/is_executable_basic.phpt index 091aca7d78..895f16e1e0 100644 --- a/ext/standard/tests/file/is_executable_basic.phpt +++ b/ext/standard/tests/file/is_executable_basic.phpt @@ -5,6 +5,17 @@ Test is_executable() function: basic functionality if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for LINUX'); } + +// Skip if being run by root (files are always readable, writeable and executable) +$filename = dirname(__FILE__)."/is_readable_root_check.tmp"; +$fp = fopen($filename, 'w'); +fclose($fp); +if(fileowner($filename) == 0) { + unlink ($filename); + die('skip...cannot be run as root\n'); +} + +unlink($filename); ?> --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE--