File Attachments Corrupted when mbstring Overloading is Enabled
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Eventum |
Fix Released
|
Wishlist
|
Elan Ruusamäe |
Bug Description
When mbstring overloading is enabled in the php.ini file, uploaded files become corrupted (or incomplete) when downloaded. Eventum appears to be calculating the size of the file by using the strlen() function. This function is transparently replaced with mb_strlen() when mbstring overloading is activated. Instead of returning the number of bytes in the file, the number of characters is returned instead. Eventum then stores and uses an incorrect value for file size.
My recommended fix is to not depend on strlen() to determine file size. Instead, use mb_strlen() with "8bit" encoding if available. Alternatively, Eventum could use the filesize() function on the temporary file created for the upload.
if (function_
$size = mb_strlen($string, '8bit');
} else {
$size = strlen($string);
}
Changed in eventum: | |
assignee: | nobody → Elan Ruusamäe (glen666) |
importance: | Undecided → Wishlist |
milestone: | none → 3.0 |
status: | New → Fix Released |
would be a lot easier if you pointed to actual code or method name