From 4534a90b80c725400ed6c571b72bbe719ba43e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 12 Feb 2016 10:22:21 +0100 Subject: [PATCH] Silent warnings when checking for file existance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Another occurences of file_exists which can be limited by open_basedir. Issue #11940 Signed-off-by: Michal Čihař --- index.php | 4 ++-- libraries/Config.class.php | 2 +- libraries/file_listing.lib.php | 2 +- libraries/plugins/auth/AuthenticationCookie.class.php | 4 ++-- libraries/plugins/auth/AuthenticationHttp.class.php | 2 +- libraries/plugins/auth/swekey/swekey.auth.lib.php | 4 ++-- libraries/plugins/export/ExportPdf.class.php | 2 +- libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php | 2 +- libraries/select_lang.lib.php | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/index.php b/index.php index 17b0e7aa21..526fc06e6d 100644 --- a/index.php +++ b/index.php @@ -543,7 +543,7 @@ if (! empty($_SESSION['encryption_key']) * Check for existence of config directory which should not exist in * production environment. */ -if (file_exists('config')) { +if (@file_exists('config')) { trigger_error( __( 'Directory [code]config[/code], which is used by the setup script, ' . @@ -661,7 +661,7 @@ if ($cfg['SuhosinDisableWarning'] == false * * The data file is created while creating release by ./scripts/remove-incomplete-mo */ -if (file_exists('libraries/language_stats.inc.php')) { +if (@file_exists('libraries/language_stats.inc.php')) { include 'libraries/language_stats.inc.php'; /* * This message is intentionally not translated, because we're diff --git a/libraries/Config.class.php b/libraries/Config.class.php index c3b220f9be..3691036c2a 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -813,7 +813,7 @@ class PMA_Config public function loadDefaults() { $cfg = array(); - if (! file_exists($this->default_source)) { + if (! @file_exists($this->default_source)) { $this->error_config_default_file = true; return false; } diff --git a/libraries/file_listing.lib.php b/libraries/file_listing.lib.php index 4e78c4623a..60b1d65ca0 100644 --- a/libraries/file_listing.lib.php +++ b/libraries/file_listing.lib.php @@ -19,7 +19,7 @@ if (! defined('PHPMYADMIN')) { */ function PMA_getDirContent($dir, $expression = '') { - if (!file_exists($dir) || !($handle = @opendir($dir))) { + if (!@file_exists($dir) || !($handle = @opendir($dir))) { return false; } diff --git a/libraries/plugins/auth/AuthenticationCookie.class.php b/libraries/plugins/auth/AuthenticationCookie.class.php index 9033c6b557..68a3e0d106 100644 --- a/libraries/plugins/auth/AuthenticationCookie.class.php +++ b/libraries/plugins/auth/AuthenticationCookie.class.php @@ -115,7 +115,7 @@ class AuthenticationCookie extends AuthenticationPlugin $header->disableMenuAndConsole(); $header->disableWarnings(); - if (file_exists(CUSTOM_HEADER_FILE)) { + if (@file_exists(CUSTOM_HEADER_FILE)) { include CUSTOM_HEADER_FILE; } echo ' @@ -263,7 +263,7 @@ class AuthenticationCookie extends AuthenticationPlugin echo ''; } echo ''; - if (file_exists(CUSTOM_FOOTER_FILE)) { + if (@file_exists(CUSTOM_FOOTER_FILE)) { include CUSTOM_FOOTER_FILE; } if (! defined('TESTSUITE')) { diff --git a/libraries/plugins/auth/AuthenticationHttp.class.php b/libraries/plugins/auth/AuthenticationHttp.class.php index 5a5a2730dc..326078d242 100644 --- a/libraries/plugins/auth/AuthenticationHttp.class.php +++ b/libraries/plugins/auth/AuthenticationHttp.class.php @@ -103,7 +103,7 @@ class AuthenticationHttp extends AuthenticationPlugin ); $response->addHTML(''); - if (file_exists(CUSTOM_FOOTER_FILE)) { + if (@file_exists(CUSTOM_FOOTER_FILE)) { include CUSTOM_FOOTER_FILE; } diff --git a/libraries/plugins/auth/swekey/swekey.auth.lib.php b/libraries/plugins/auth/swekey/swekey.auth.lib.php index 1741ca7764..c296e96173 100644 --- a/libraries/plugins/auth/swekey/swekey.auth.lib.php +++ b/libraries/plugins/auth/swekey/swekey.auth.lib.php @@ -24,7 +24,7 @@ function Swekey_Auth_check() $_SESSION['SWEKEY'] = array(); } - $_SESSION['SWEKEY']['ENABLED'] = (! empty($confFile) && file_exists($confFile)); + $_SESSION['SWEKEY']['ENABLED'] = (! empty($confFile) && @file_exists($confFile)); // Load the swekey.conf file the first time if ($_SESSION['SWEKEY']['ENABLED'] @@ -169,7 +169,7 @@ function Swekey_Auth_error() // echo "\n"; } - if (file_exists($caFile)) { + if (@file_exists($caFile)) { Swekey_SetCAFile($caFile); } elseif (! empty($caFile) && (substr($_SESSION['SWEKEY']['CONF_SERVER_CHECK'], 0, 8) == "https://") diff --git a/libraries/plugins/export/ExportPdf.class.php b/libraries/plugins/export/ExportPdf.class.php index 272004683d..07b425eb03 100644 --- a/libraries/plugins/export/ExportPdf.class.php +++ b/libraries/plugins/export/ExportPdf.class.php @@ -13,7 +13,7 @@ if (! defined('PHPMYADMIN')) { /** * Skip the plugin if TCPDF is not available. */ -if (! file_exists(TCPDF_INC)) { +if (! @file_exists(TCPDF_INC)) { $GLOBALS['skip_import'] = true; return; } diff --git a/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php b/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php index 9f48425a97..ef37c793aa 100644 --- a/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php +++ b/libraries/plugins/schema/pdf/Pdf_Relation_Schema.class.php @@ -12,7 +12,7 @@ if (! defined('PHPMYADMIN')) { /** * Skip the plugin if TCPDF is not available. */ -if (! file_exists(TCPDF_INC)) { +if (! @file_exists(TCPDF_INC)) { $GLOBALS['skip_import'] = true; return; } diff --git a/libraries/select_lang.lib.php b/libraries/select_lang.lib.php index da8556c553..cb99ec53d2 100644 --- a/libraries/select_lang.lib.php +++ b/libraries/select_lang.lib.php @@ -454,7 +454,7 @@ function PMA_langList() $path = $GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo'; if ($file != "." && $file != ".." - && file_exists($path) + && @file_exists($path) ) { $result[$file] = PMA_langDetails($file); }