Don't use error suppression on is_dir(), file_exists()
diff --git a/system/core/Output.php b/system/core/Output.php
index d494d00..7a35b02 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -639,7 +639,7 @@
$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 0ef0ae5..0ab9c5d 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -156,7 +156,7 @@
$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 b43e323..7758a85 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 @@
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 f80b5e7..5a28c2b 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -81,7 +81,7 @@
*/
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 0eed059..d79d15a 100644
--- a/system/database/drivers/sqlite3/sqlite3_forge.php
+++ b/system/database/drivers/sqlite3/sqlite3_forge.php
@@ -93,7 +93,7 @@
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 1392677..78eac4b 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -82,7 +82,7 @@
}
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 84ad358..0bbe7fe 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -69,9 +69,9 @@
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 fc02f83..8401a38 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -147,6 +147,7 @@
{
$this->_error('ftp_unable_to_connect');
}
+
return FALSE;
}
@@ -156,6 +157,7 @@
{
$this->_error('ftp_unable_to_login');
}
+
return FALSE;
}
@@ -572,7 +574,7 @@
// 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 62cfb28..75fc062 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -972,7 +972,7 @@
$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 40b661a..43abfba 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -133,12 +133,12 @@
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 @@
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 @@
{
$name = str_replace($root_path, '', $name);
}
+
$this->add_data($name.$file, $data);
}
}