Direct return from mimes config, instead of using global $mimes;
Global variables are generally a terrible idea, especially for something as simple as this. The mimes.php now returns an array instead of just injecting a variable name into the global namespace.
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 0061c42..068706c 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -349,17 +349,17 @@
{
$extension = strtolower(substr(strrchr($file, '.'), 1));
- global $mimes;
+ static $mimes;
if ( ! is_array($mimes))
{
if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
+ $mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
elseif (is_file(APPPATH.'config/mimes.php'))
{
- include(APPPATH.'config/mimes.php');
+ $mimes = include(APPPATH.'config/mimes.php');
}
if ( ! is_array($mimes))