Welcome Guest, Not a member yet? Register   Sign In
Possible bug in get_mime_by_extension() function
#1

[eluser]Davide Bellini[/eluser]
Using :
Code:
$this->load->helper('file');
echo get_mime_by_extension('Chrysanthemum.jpg');

Return :
Code:
A PHP Error was encountered

Severity: Warning

Message: array_key_exists() expects parameter 2 to be array, null given

Filename: helpers/file_helper.php

Line Number: 361

Is this a bug?

Cheers
#2

[eluser]twmulloy[/eluser]
yeah, this started doing this when i upgraded to 2.0.1, it worked in 2.0.0, haven't looked into a whole lot but imagine it something to do with the additional mime types that were added in 2.0.1, or it can no longer load the mime config is what i think since it's trying to pass null instead of the previous array..
#3

[eluser]InsiteFX[/eluser]
Ok, I figured out whats going on here!

The get_mime_by_extension() is not seeing the mimes array as global, yet it is using in the file_helper
global $mimes.

Here is a quick fix that works for now!

open up application/config/mimes.php and at the very top of the array add global $mimes; !

Now it will work!

I am sure there is a better way to fix it, but it works until the Reactor team can fix it the right way!

InsiteFX
#4

[eluser]Davide Bellini[/eluser]
I've reported the issue on bitbucket :
https://bitbucket.org/ellislab/codeignit...n-function
#5

[eluser]Phil Sturgeon[/eluser]
Fixed in the tip.




Theme © iAndrew 2016 - Forum software by © MyBB