Forum Replies Created
-
AuthorPosts
-
dbn
ParticipantMystery cleared up. Our third-party software services provider made the changes during the process of migrating our site from an old version of Joomla to the latest stable version, along with updating or replacing all the plugins, templates and modules that our site was using. They said the change was made to “work with older versions of PHP”. I politely explained why that was a Bad Idea ™ and that it actually broke the code. Thanks for your time and assistance. I will back out all of their changes.
dbn
ParticipantAh, I see it now. The small text hyperlink at the bottom of the page. I was looking for a big download button near the top of the page. 🙂 Thanks!
dbn
ParticipantI’m still waiting for an activation email for my new account at valorapps.com, so that I can “get” a fresh copy of the 2.7.8 package for comparison. (I don’t see a way to request a re-send.)
I see the questionable FILEINFO_MIME used in the easydiagnostic.php file, too, so if someone changed that constant, it was done consistently. It wasn’t me, but I’m not the original webmaster for our site.
Odd, indeed.
dbn
ParticipantOK, once again answering my own question… 🙂 No, the MIME type comparison would ignore the charset information in only some of the alternate supported methods. I was able to fix my problem by adding the code stripping out the charset information to the code path using the FILEINFO_MIME method. The code is added after line 213 in the helper function actualMime in the class modEasyFileUploaderHelper in the file helper.php.
The relevant section of code is as follows:
// try to use recommended functions
if (defined(‘FILEINFO_MIME’) &&
function_exists(‘finfo_open’) && is_callable(‘finfo_open’) &&
function_exists(‘finfo_file’) && is_callable(‘finfo_file’) &&
function_exists(‘finfo_close’) && is_callable(‘finfo_close’))
{
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $file);
if ($mime === ”)
{
$mime = false;
}
finfo_close($finfo);
//this removes the charset value if it was returned with the mime type. mime is first.
$mime = strtok($mime, ‘; ‘);
$mime = trim($mime); //remove any remaining whitespace
}
The added code is emphasized.
dbn
ParticipantA little more research on the PHP side. The inclusion of “charset” in the returned string was introduced in PHP 5.3+ to make it RFC2045 compliant. I don’t know what version of PHP our host was running prior to the recent upgrade, but it does seem unlikely to have been as old as 5.2. Although, I suppose it’s possible.
Can anyone confirm that the MIME type comparison code in Easy File Uploader 2.7.8 is written to expect the inclusion of the charset information?
dbn
ParticipantI tested again using a different invocation of Easy File Uploader on our site, to upload photos. This is the error message I received:
ERROR: The uploaded file type is not permitted.
MIME detected by PHP: (image/png; charset=binary)
MIME detected by Browser: image/png
I’m a bit dubious about the “charset=binary”, as images don’t have character sets, right?
One additional thing that has changed (besides the Joomla version update) is a newer version of PHP. Should the PHP MIME type detection function be returning the “charset=binary” notation?
-
AuthorPosts