diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-26 17:41:59 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-26 17:41:59 +0100 |
commit | 382b51383c84fbb7f861fcd87b0b71b35c9f2869 (patch) | |
tree | 9aa8bf35189e3a7f4a8a6923bafba758d15aa90b | |
parent | ea41c8aa1951216b6a9ccc99832d69d2b41c5ead (diff) |
Don't use error suppression on is_dir(), file_exists()
-rw-r--r-- | system/core/Output.php | 2 | ||||
-rw-r--r-- | system/database/DB_cache.php | 2 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php | 2 | ||||
-rw-r--r-- | system/database/drivers/sqlite/sqlite_forge.php | 2 | ||||
-rw-r--r-- | system/database/drivers/sqlite3/sqlite3_forge.php | 2 | ||||
-rw-r--r-- | system/helpers/captcha_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/directory_helper.php | 4 | ||||
-rw-r--r-- | system/libraries/Ftp.php | 4 | ||||
-rw-r--r-- | system/libraries/Upload.php | 2 | ||||
-rw-r--r-- | system/libraries/Zip.php | 11 |
10 files changed, 18 insertions, 15 deletions
diff --git a/system/core/Output.php b/system/core/Output.php index d494d0080..7a35b02da 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -639,7 +639,7 @@ class CI_Output { $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; $filepath = $cache_path.md5($uri); - if ( ! @file_exists($filepath) OR ! $fp = @fopen($filepath, FOPEN_READ)) + if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, FOPEN_READ)) { return FALSE; } diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 0ef0ae52f..0ab9c5d6b 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -156,7 +156,7 @@ class CI_DB_Cache { $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); - if ( ! @is_dir($dir_path)) + if ( ! is_dir($dir_path)) { if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) { diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php index b43e3238d..7758a8578 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php @@ -107,7 +107,7 @@ class CI_DB_pdo_sqlite_forge extends CI_DB_pdo_forge { public function drop_database($db_name = '') { // In SQLite, a database is dropped when we delete a file - if (@file_exists($this->db->database)) + if (file_exists($this->db->database)) { // We need to close the pseudo-connection first $this->db->close(); diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index f80b5e71b..5a28c2b35 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -81,7 +81,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { */ public function drop_database($db_name = '') { - if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database)) + if ( ! file_exists($this->db->database) OR ! @unlink($this->db->database)) { return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; } diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php index 0eed05908..d79d15afd 100644 --- a/system/database/drivers/sqlite3/sqlite3_forge.php +++ b/system/database/drivers/sqlite3/sqlite3_forge.php @@ -93,7 +93,7 @@ class CI_DB_sqlite3_forge extends CI_DB_forge { public function drop_database($db_name = '') { // In SQLite, a database is dropped when we delete a file - if (@file_exists($this->db->database)) + if (file_exists($this->db->database)) { // We need to close the pseudo-connection first $this->db->close(); diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 13926774e..78eac4be0 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -82,7 +82,7 @@ if ( ! function_exists('create_captcha')) } if ($img_path === '' OR $img_url === '' - OR ! @is_dir($img_path) OR ! is_really_writable($img_path) + OR ! is_dir($img_path) OR ! is_really_writable($img_path) OR ! extension_loaded('gd')) { return FALSE; diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 84ad35894..0bbe7fe97 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -69,9 +69,9 @@ if ( ! function_exists('directory_map')) continue; } - @is_dir($source_dir.$file) && $file .= DIRECTORY_SEPARATOR; + is_dir($source_dir.$file) && $file .= DIRECTORY_SEPARATOR; - if (($directory_depth < 1 OR $new_depth > 0) && @is_dir($source_dir.$file)) + if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir.$file)) { $filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden); } diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index fc02f8300..8401a380e 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -147,6 +147,7 @@ class CI_FTP { { $this->_error('ftp_unable_to_connect'); } + return FALSE; } @@ -156,6 +157,7 @@ class CI_FTP { { $this->_error('ftp_unable_to_login'); } + return FALSE; } @@ -572,7 +574,7 @@ class CI_FTP { // Recursively read the local directory while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($locpath.$file) && $file[0] !== '.') + if (is_dir($locpath.$file) && $file[0] !== '.') { $this->mirror($locpath.$file.'/', $rempath.$file.'/'); } diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 62cfb28c0..75fc0624f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -972,7 +972,7 @@ class CI_Upload { $this->upload_path = str_replace('\\', '/', realpath($this->upload_path)); } - if ( ! @is_dir($this->upload_path)) + if ( ! is_dir($this->upload_path)) { $this->set_error('upload_no_filepath'); return FALSE; diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 40b661abc..43abfba42 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -133,12 +133,12 @@ class CI_Zip { protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = file_exists($dir) ? @filemtime($dir) : getdate($this->now); + $date = file_exists($dir) ? filemtime($dir) : getdate($this->now); return array( - 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, - 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] - ); + 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, + 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] + ); } // -------------------------------------------------------------------- @@ -342,7 +342,7 @@ class CI_Zip { continue; } - if (@is_dir($path.$file)) + if (is_dir($path.$file)) { $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); } @@ -353,6 +353,7 @@ class CI_Zip { { $name = str_replace($root_path, '', $name); } + $this->add_data($name.$file, $data); } } |