From a852b0e89b05ba9bc184586fba0fe242d0cf4f79 Mon Sep 17 00:00:00 2001
From: robocoder <anthon.pang@gmail.com>
Date: Wed, 19 Jan 2011 02:08:18 +0000
Subject: [PATCH] fixes http://forum.piwik.org/read.php?5,71479

git-svn-id: http://dev.piwik.org/svn/trunk@3779 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 .../PhpSecInfo/Test/Core/upload_tmp_dir.php           | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
index 729c702daf..7e6186ba7f 100644
--- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
+++ b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php
@@ -64,9 +64,10 @@ class PhpSecInfo_Test_Core_Upload_Tmp_Dir extends PhpSecInfo_Test_Core
 	 */
 	function _execTest() {
 
-		$perms = fileperms($this->current_value);
-
-		if ($this->current_value
+		$perms = @fileperms($this->current_value);
+		if ($perms === false) {
+			return PHPSECINFO_TEST_RESULT_WARN;
+		} else if ($this->current_value
 			&& !preg_match("|".PHPSECINFO_TEST_COMMON_TMPDIR."/?|", $this->current_value)
 			&& ! ($perms & 0x0004)
 			&& ! ($perms & 0x0002) ) {
@@ -79,7 +80,6 @@ class PhpSecInfo_Test_Core_Upload_Tmp_Dir extends PhpSecInfo_Test_Core
 		return PHPSECINFO_TEST_RESULT_NOTICE;
 	}
 
-
 	/**
 	 * Set the messages specific to this test
 	 *
@@ -90,10 +90,11 @@ class PhpSecInfo_Test_Core_Upload_Tmp_Dir extends PhpSecInfo_Test_Core
 		$this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'Test not run -- currently disabled on Windows OSes');
 		$this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_tmp_dir is enabled, which is the
 						recommended setting. Make sure your upload_tmp_dir path is not world-readable');
+		$this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'unable to retrieve file permissions on upload_tmp_dir');
 		$this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'upload_tmp_dir is disabled, or is set to a
 						common world-writable directory.  This typically allows other users on this server
 						to access temporary copies of files uploaded via your PHP scripts.  You should set
 						upload_tmp_dir to a non-world-readable directory');
 	}
 
-}
\ No newline at end of file
+}
-- 
GitLab