I'm not too sure actually how to reproduce, but the bug is pretty obvious. In my case search bots were hitting a non-existing link /2016-09-27-03-40-18/32-about/aboutus
and getting Error 500 instead of 404, filling the error log with entries like this:
PHP Catchable fatal error: Argument 1 passed to Joomla\Utilities\ArrayHelper::sortObjects() must be of the type array, boolean given, called in /home/site/public_html/components/com_content/models/category.php on line 462 and defined in /home/site/public_html/libraries/vendor/joomla/utilities/src/ArrayHelper.php on line 486
HTTP Error 404 "Category not found"
HTTP Error 500 and above error_log entry
Joomla v3.6.5, PHP 5.4.45
in the getCategory() line 382 if a category is not found then $this->_children = false;
down the track, in getChildren() line 456 there's a condition if (count($this->_children))
which returns 1 and causes the sorting block to execute and fail.
The simple solution is to fix the condition to be if ($this->_children)
, a bit smarter would be if (count($this->_children) > 1)
Reference: http://php.net/manual/en/function.count.php
Returns the number of elements in array_or_countable. If the parameter is not an array or not an object with implemented Countable interface, 1 will be returned.
Not sure how, is there an instruction?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-29 08:27:51 |
Closed_By | ⇒ | brianteeman |
Hi,
can you send your changes as pull request against staging than?