0

I'm currently testing a site (EE 2.10.1) and getting a string of the following errors when trying to do anything with image uploads.

A PHP Error was encountered Severity: Notice Message: Use of undefined constant FILEINFO_MIME_TYPE - assumed 'FILEINFO_MIME_TYPE' Filename: Mime/MimeType.php Line Number: 117

A PHP Error was encountered Severity: Warning Message: finfo_open() expects parameter 1 to be long, string given Filename: Mime/MimeType.php Line Number: 117

This supposedly stems from the fileinfo extensions only being available from 5.3.10 onwards. The PHP version on this server is 5.3.29 and it looks to have been compiled -with-fileinfo

I have a support request in with the hosting company at the moment but I wondered if anyone else had run into this and may have a workaround.

2 Answers 2

0

There's a simple workaround, but it does require modifying the core files....

Danger, there be pirates

You're best bet is to change th code to use FILEINFO_MIME, so instead of FILEINFO_MIME_TYPE use :

( strstr(FILEINFO_MIME, ";") === false ? FILEINFO_MIME : substr( FILEINFO_MIME, 0, strstr(FILEINFO_MIME, ";") - 1 ) )

(You need to split the string by the semi colon, if there is one)

Or use the function mime_get_content_type() which should get you there.

Ref : https://stackoverflow.com/questions/7906292/fileinfo-mime-type-is-undefined

0

Turns out that in this case it was simply that PHP 5.3 had been mistakenly compiled with an old version of the fileinfo extension. The host recompiled it and now all works as it should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.