[eluser]Madmartigan1[/eluser]
I just "upgraded" to 2.0.1 this morning and found that the mimes array is not being loaded when calling get_mime_by_extension().
Code:
A PHP Error was encountered
Severity: Warning
Message: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object
Filename: helpers/file_helper.php
Line Number: 361
There has been no change to the helper. Here is where the issue happens:
Code:
if ( ! function_exists('get_mime_by_extension'))
{
function get_mime_by_extension($file)
{
$extension = strtolower(substr(strrchr($file, '.'), 1));
global $mimes;
if ( ! is_array($mimes))
{
if ( ! require_once(APPPATH.'config/mimes.php'))
{
return FALSE;
}
}
exit(var_dump($mimes)); // returns NULL <--------------------------
if (array_key_exists($extension, $mimes))
{
if (is_array($mimes[$extension]))
{
// Multiple mime types, just give the first one
return current($mimes[$extension]);
}
else
{
return $mimes[$extension];
}
}
else
{
return FALSE;
}
}
}
I tried this on a clean WAMP install, and updated my mimes.php (which did nothing).
Note that this was working in the last release.
Aside: There is also some Migrations junk in the main download which has been there for some time, and doesn't belong. Is it too much effort to remove it? Are things getting sloppy?