? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
2 Apr 2019

Pull Request for Issue #24452.

Summary of Changes

added the check

Testing Instructions

see #24452

avatar alikon alikon - open - 2 Apr 2019
avatar alikon alikon - change - 2 Apr 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2019
Category Administration com_content
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Apr 2019
Title
[4.0][com_content] - boolean check
[4.0] [com_content] - boolean check
avatar joomla-cms-bot joomla-cms-bot - edited - 3 Apr 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Apr 2019

@chmst can you please test?

avatar chmst
chmst - comment - 4 Apr 2019

This does not work. It results in a notice in view.html.php, where an array is expected, empty or not..
An empty result in articles is quite normal.
The related issue was probably caused by an inconxistency in the database of my repo. After installing the whole new with a fresh database, theis issue was solved.

avatar mbabker
mbabker - comment - 4 Apr 2019

It results in a notice in view.html.php, where an array is expected, empty or not..

The view needs to account for this return type too. Folks, error handling is simple; you should not be writing code assuming that things will never have errors and things will always work as expected and you can't tell people the fix to running into these errors is to drop your database and reinstall everything. Error handling is not a new programming concept, but the fact that Joomla has next to none of it is quite embarrassing.

avatar ggppdk
ggppdk - comment - 4 Apr 2019

I agree with @chmst
Finding zero records is not an error to return false
An empty array should be returned.

Regarding the error handling in case that this method return false on real errors, i agree with @mbabker, view.html.php should be patched too (in some other PR along with other files ?)

avatar mbabker
mbabker - comment - 4 Apr 2019

Finding 0 records is not the error, getItems() in that case should be returning an empty array (because of type coercion with PHP the if check probably needs to be if ($items === false)). The intent here is to handle the case when getItems() DOES reach an error and returns boolean false instead of an array. And no, returning an empty array in the error case is not a proper fix.

avatar alikon alikon - change - 4 Apr 2019
Labels Added: ?
avatar alikon alikon - change - 6 Apr 2019
Labels Added: J4 Issue
avatar alikon
alikon - comment - 6 Apr 2019

patched the view

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
[4.0] [com_content] - boolean check
[4.0] boolean check
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar euismod2336
euismod2336 - comment - 4 May 2019

Well, as far as i can quickly see, it's possible to get an empty array from getTransitions. That gives a 500 error however because the view checks for falsy instead of false.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24458.

avatar wilsonge
wilsonge - comment - 4 May 2019

@alikon can you patch the comment from @euismod2336 please

avatar alikon
alikon - comment - 6 May 2019

@wilsonge @euismod2336 not sure to understand can you elaborate and/or add suggestion, pr is open

avatar wilsonge wilsonge - change - 7 May 2019
Labels Removed: J4 Issue
avatar wilsonge wilsonge - change - 7 May 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-05-07 10:42:19
Closed_By wilsonge
avatar wilsonge wilsonge - close - 7 May 2019
avatar wilsonge wilsonge - merge - 7 May 2019
avatar wilsonge
wilsonge - comment - 7 May 2019

Done and thanks :)

Add a Comment

Login with GitHub to post a comment