? Success

User tests: Successful: Unsuccessful:

avatar olleharstedt
olleharstedt
17 May 2018

Pull Request for Issue #20246.

Summary of Changes

Add static variable $uploadResult to JFile class.

Testing Instructions

Run JFile::upload(). Run JFile::getUploadResult().

Expected result

$uploadResult is set to result of upload() method.

Actual result

Documentation Changes Required

Don't know.

avatar olleharstedt olleharstedt - open - 17 May 2018
avatar olleharstedt olleharstedt - change - 17 May 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 May 2018
Category Libraries
avatar PhilETaylor PhilETaylor - comment - 17 May 2018
avatar olleharstedt
olleharstedt - comment - 17 May 2018

Hm, those constants does not really reflect the error messages logged in upload().

avatar PhilETaylor PhilETaylor - comment - 17 May 2018
avatar olleharstedt
olleharstedt - comment - 17 May 2018

Something that could be discussed is if we should use the convention "0 for success" instead of "truthy for success", as I've used now (the constants start at 1 and then counts down).

avatar laoneo
laoneo - comment - 17 May 2018

Should we not start throwing exceptions? I don't like to have state full helper classes. It is not wrong how you do it, but we can do better.

avatar PhilETaylor PhilETaylor - comment - 17 May 2018
avatar laoneo
laoneo - comment - 17 May 2018

Hit the "Comment" button too early. Yes then we should do it against J4.

avatar olleharstedt
olleharstedt - comment - 17 May 2018

I agree that throwing exception is the correct way, but yes, it's about backwards compatibility. Alternatively, we can have a new method uploadWithException or something, that does throw exception (code duplication, though...).

avatar mbabker
mbabker - comment - 17 May 2018

Instead of trying to cater for B/C, do it once and do it right. Do a PR against 4.0 (and the 2.0 branch of the Framework's Filesystem package) breaking B/C to do it right. Yeah it means you have to live with the "busted" code for the rest of the 3.x lifetime, but at this point it's better than adding something that creates new stateful statics or APIs which are nothing more than complete hacks that are going to have to stay in the API for who knows how long.

avatar olleharstedt olleharstedt - change - 17 May 2018
Labels Added: ?
avatar olleharstedt
olleharstedt - comment - 22 May 2018

How about changing the return value from true/false to 1 and 0/-1/-2 etc as return codes? It would break compatibility, but not "so much" (only if client code uses ===).

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2019

@olleharstedt whats the state of this Pull Request?

avatar olleharstedt
olleharstedt - comment - 12 May 2019

@franz-wohlkoenig It should be closed, and a discussion should be had about my other suggestion: to return integer instead of boolean as a result code OR throw exception in version 4 instead.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2019

thanks @olleharstedt - can you open an issue about "return integer instead of boolean"?
closed as stated above.

avatar franz-wohlkoenig franz-wohlkoenig - change - 12 May 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-05-12 08:17:08
Closed_By franz-wohlkoenig
Labels Removed: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - close - 12 May 2019
avatar olleharstedt
olleharstedt - comment - 12 May 2019

Sure, I'll have a look tomorrow. ?

Add a Comment

Login with GitHub to post a comment