? Success

User tests: Successful: Unsuccessful:

avatar dmb-dz
dmb-dz
14 May 2014

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. ;-)

avatar dmb-dz dmb-dz - open - 14 May 2014
avatar dmb-dz
dmb-dz - comment - 14 May 2014

Issue-Tracker ID: #33734

avatar Bakual
Bakual - comment - 14 May 2014

Would it make more sense to move the toBytes($val) method to the JHelperMedia class?

Please also make sure you follow our coding standards (http://joomla.github.io/coding-standards/?coding-standards/chapters/php.md).

avatar dmb-dz
dmb-dz - comment - 14 May 2014

Would it make more sense to move the toBytes($val) method to the JHelperMedia class?

Definitively. I'll update the code accordingly taking

Please also make sure you follow our coding standards (http://joomla.github.io/coding-standards/?coding-standards/chapters/php.md).

your coding standards into account. ;-)
(Btw, those should be placed more prominently, all I found were some dead links and/or depreceated pages.)

Thx for the quick reply.

avatar Bakual
Bakual - comment - 14 May 2014

Btw, those should be placed more prominently, all I found were some dead links and/or depreceated pages

Agreed. And I actually want to improve the contribute.md for quite some time. Just have to do it...

avatar dmb-dz dmb-dz - reference | - 14 May 14
avatar dmb-dz
dmb-dz - comment - 14 May 2014

@Bakual There's only one thing that bugs me, the function name. Do you have any other (preferably better) suggestion? ;-)

avatar Bakual
Bakual - comment - 14 May 2014

I wouldn't add the proxy function to administrator/components/com_media/helpers/media.php. The whole class is deprecated, so adding stuff is probably no good idea. :smile:

As for the function name, maybe convertToBytes or something. However toBytes is fine for me as well.

avatar dmb-dz
dmb-dz - comment - 14 May 2014

I wouldn't add the proxy function to administrator/components/com_media/helpers/media.php. The whole class is deprecated, so adding stuff is probably no good idea.

True, but JMediaHelper isn't imported currently (as far as I can see it's not really in use currently) and as all other MediaHelper functions are still in place there I thought it'd can be moved later on transparently with the other calls.

As for the function name, maybe convertToBytes or something. However toBytes is fine for me as well.

I'll leave it as is then. :sunglasses:

avatar Bakual
Bakual - comment - 14 May 2014

True, but JMediaHelper isn't imported currently

It should autoload :smile:

avatar dmb-dz
dmb-dz - comment - 14 May 2014

I was in the midst of answering you when it dawned me that I should instantiate it and not call it statically. :blush:
Fix incoming…

avatar brianteeman
brianteeman - comment - 26 Jul 2014

Closing as we have an updated PR #3976

avatar brianteeman brianteeman - change - 26 Jul 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-26 10:57:29
avatar brianteeman brianteeman - close - 26 Jul 2014

Add a Comment

Login with GitHub to post a comment