joomla/joomla-cms — pull request #3592 by dmb-dz (2014-05-14 09:51:00+00:00)
Title: Don't assume M as suffix for size configuration values in admin/com_media

Instead take the possible values defined in the php configuration into
account (k,m,g and upper case as well). The function is the optimized
version found on php.net but using brackets and `strlen()` to access the
last character instead of `substr()`.

This change fixes an upload issue in the MediaManager when any
configuration setting uses something different than the assumed 'M/m'
suffix. A small example should make this clearer:
Imagine 'memory_limit' being set to '1G'.
`(int) (ini_get('memory_limit')) * 1024 * 1024` would resolve to
1048576 Bytes (~=1M), a value (almost certainly) being lower than
most of the media files an average user would like to upload. ;-)