diff --git a/ChangeLog b/ChangeLog index 3357a9cf9b..87bad6630f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,8 @@ phpMyAdmin - ChangeLog - issue #11946 Correctly store and report file upload errors - issue #11948 Avoid javascript errors on invalid location hash - issue #11950 Fix PHP warning on configuration errors +- issue #11951 Silent errors on checking for writable folders +- issue #11952 Silent warning on invalid file upload 4.5.4.1 (2016-01-29) - issue #11892 Error with PMA 4.4.15.3 diff --git a/changelog.php b/changelog.php index 79afe72ac8..cfc74e348f 100644 --- a/changelog.php +++ b/changelog.php @@ -20,7 +20,7 @@ $filename = CHANGELOG_FILE; * Read changelog. */ // Check if the file is available, some distributions remove these. -if (is_readable($filename)) { +if (@is_readable($filename)) { // Test if the if is in a compressed format if (substr($filename, -3) == '.gz') { diff --git a/import.php b/import.php index 18a5f1fe9d..e7b4c76a38 100644 --- a/import.php +++ b/import.php @@ -452,7 +452,7 @@ if ($import_file != 'none' && ! $error) { $tmp_subdir = sys_get_temp_dir(); } $tmp_subdir = rtrim($tmp_subdir, DIRECTORY_SEPARATOR); - if (is_writable($tmp_subdir)) { + if (@is_writable($tmp_subdir)) { $import_file_new = $tmp_subdir . DIRECTORY_SEPARATOR . basename($import_file) . uniqid(); if (move_uploaded_file($import_file, $import_file_new)) { diff --git a/libraries/Config.php b/libraries/Config.php index a929aacef6..e76a880edf 100644 --- a/libraries/Config.php +++ b/libraries/Config.php @@ -1113,12 +1113,12 @@ class Config return false; } - if (! file_exists($this->getSource())) { + if (! @file_exists($this->getSource())) { $this->source_mtime = 0; return false; } - if (! is_readable($this->getSource())) { + if (! @is_readable($this->getSource())) { // manually check if file is readable // might be bug #3059806 Supporting running from CIFS/Samba shares diff --git a/libraries/File.php b/libraries/File.php index b70a448c2f..b456fb2727 100644 --- a/libraries/File.php +++ b/libraries/File.php @@ -439,10 +439,7 @@ class File { // suppress warnings from being displayed, but not from being logged // any file access outside of open_basedir will issue a warning - ob_start(); - $is_readable = is_readable($this->getName()); - ob_end_clean(); - return $is_readable; + return @is_readable($this->getName()); } /** @@ -461,7 +458,7 @@ class File } if (empty($GLOBALS['cfg']['TempDir']) - || ! is_writable($GLOBALS['cfg']['TempDir']) + || ! @is_writable($GLOBALS['cfg']['TempDir']) ) { // cannot create directory or access, point user to FAQ 1.11 $this->_error_message = __( diff --git a/libraries/export.lib.php b/libraries/export.lib.php index db61086481..5032beacbd 100644 --- a/libraries/export.lib.php +++ b/libraries/export.lib.php @@ -337,7 +337,7 @@ function PMA_openExportFile($filename, $quick_export) ) ); $message->addParam($save_filename); - } elseif (is_file($save_filename) && ! is_writable($save_filename)) { + } elseif (@is_file($save_filename) && ! @is_writable($save_filename)) { $message = Message::error( __( 'The web server does not have permission ' diff --git a/libraries/file_listing.lib.php b/libraries/file_listing.lib.php index 097fc88511..64f7230634 100644 --- a/libraries/file_listing.lib.php +++ b/libraries/file_listing.lib.php @@ -25,7 +25,7 @@ function PMA_getDirContent($dir, $expression = '') $dir .= '/'; } while ($file = @readdir($handle)) { - if (is_file($dir . $file) + if (@is_file($dir . $file) && ($expression == '' || preg_match($expression, $file)) ) { $result[] = $file; diff --git a/libraries/plugins/import/ImportShp.php b/libraries/plugins/import/ImportShp.php index 9d590d0ebc..dd72a893b7 100644 --- a/libraries/plugins/import/ImportShp.php +++ b/libraries/plugins/import/ImportShp.php @@ -83,7 +83,7 @@ class ImportShp extends ImportPlugin // and use the files in it for import if ($compression == 'application/zip' && !empty($GLOBALS['cfg']['TempDir']) - && is_writable($GLOBALS['cfg']['TempDir']) + && @is_writable($GLOBALS['cfg']['TempDir']) ) { $dbf_file_name = PMA_findFileFromZipArchive( '/^.*\.dbf$/i', diff --git a/license.php b/license.php index 2c463a6efb..05f6f05627 100644 --- a/license.php +++ b/license.php @@ -25,7 +25,7 @@ header('Content-type: text/plain; charset=utf-8'); $filename = LICENSE_FILE; // Check if the file is available, some distributions remove these. -if (is_readable($filename)) { +if (@is_readable($filename)) { readfile($filename); } else { printf( diff --git a/prefs_manage.php b/prefs_manage.php index ab69878b16..44964e70de 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -60,7 +60,7 @@ if (isset($_POST['submit_export']) // directory if (!empty($open_basedir)) { $tmp_subdir = (PMA_IS_WINDOWS ? '.\\tmp\\' : 'tmp/'); - if (is_writable($tmp_subdir)) { + if (@is_writable($tmp_subdir)) { $import_file_new = tempnam($tmp_subdir, 'prefs'); if (move_uploaded_file($import_file, $import_file_new)) { $import_file = $import_file_new; diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php index 162663d991..c4de5964a4 100644 --- a/setup/lib/index.lib.php +++ b/setup/lib/index.lib.php @@ -201,13 +201,13 @@ function PMA_checkConfigRw(&$is_readable, &$is_writable, &$file_exists) $file_path = $GLOBALS['ConfigFile']->getFilePath(); $file_dir = dirname($file_path); $is_readable = true; - $is_writable = is_dir($file_dir); + $is_writable = @is_dir($file_dir); if (SETUP_DIR_WRITABLE) { - $is_writable = $is_writable && is_writable($file_dir); + $is_writable = $is_writable && @is_writable($file_dir); } $file_exists = file_exists($file_path); if ($file_exists) { $is_readable = is_readable($file_path); - $is_writable = $is_writable && is_writable($file_path); + $is_writable = $is_writable && @is_writable($file_path); } }