User tests: Successful: Unsuccessful:
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content |
Title |
|
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.
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.
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.
Labels |
Added:
?
|
Labels |
Added:
J4 Issue
|
patched the view
Title |
|
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.
@alikon can you patch the comment from @euismod2336 please
@wilsonge @euismod2336 not sure to understand can you elaborate and/or add suggestion, pr is open
Labels |
Removed:
J4 Issue
|
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-05-07 10:42:19 |
Closed_By | ⇒ | wilsonge |
Done and thanks :)
@chmst can you please test?