When there is any item to show in a (frontend) tag view, the php interpreter indicates the following error:
Notice: Trying to get property of non-object in .../components/com_tags/views/tag/view.html.php
on line 120
The error appears when $items is equal to false and, so, counting a false returns 1 —it's PHP implementation. That causes that executing $items[0] launches the error because $count > 0 and $items is not an object.
Not easy. I get this error because a tag, according to Joomla CMS, is not linked to any item —which is false!!!
So I suggest to mock $items and make it false to check this error.
No error.
Notice: Trying to get property of non-object in .../components/com_tags/views/tag/view.html.php
on line 120
Joomla 3.7.0
PHP 7.0.13
MacOs 10.12.4
This error is minor (even trivial) since it does not affect the output of the view. But it still an error and can be caused additional errors in future versions of the view.
I would like to propose the next solution:
Change line 119 to: $count = ($items) ? count ($items) : 0;
Although it can be changed the line 120 (where $count is tested) and $count is not used later, I think is more logical to get a zero when a false is counted.
Labels |
Added:
?
|
Category | ⇒ | com_tags |
Status | New | ⇒ | Discussion |
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-17 13:19:26 |
Closed_By | ⇒ | zero-24 |
Thanks @PhilETaylor
Please close and test #16077