? ? Pending
Pull Request for # 14982

User tests: Successful: Unsuccessful:

avatar Quy
Quy
17 Jan 2018

This Pull Request improves PR #14982.

Summary of Changes

Check for array to prevent count() warning.

The warning is due to count(false).

Testing Instructions

Install demo.
In the browser's address bar, enter http://localhost/joomla-cms-staging/archived-articles/2011/1/archives. (replace http://localhost/joomla-cms-staging/ with your domain)
A 404 page is displayed.
Check PHP error log.

Expected result

no warnings

Actual result

PHP Warning: count(): Parameter must be an array or an object that implements Countable in \components\com_content\models\category.php on line 457

Documentation Changes Required

none

avatar Quy Quy - open - 17 Jan 2018
avatar Quy Quy - change - 17 Jan 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2018
Category Front End com_content
avatar Quy Quy - change - 17 Jan 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-01-17 18:04:48
Closed_By Quy
Rel_Number 14982
Relation Type Pull Request for
avatar Quy Quy - change - 17 Jan 2018
Labels Added: ?
avatar Quy Quy - close - 17 Jan 2018
avatar Quy Quy - change - 17 Jan 2018
Status Closed New
Closed_Date 2018-01-17 18:04:48
Closed_By Quy
avatar Quy Quy - change - 17 Jan 2018
Status New Pending
avatar Quy Quy - reopen - 17 Jan 2018
avatar Quy Quy - change - 17 Jan 2018
The description was changed
avatar Quy Quy - edited - 17 Jan 2018
avatar brianteeman
brianteeman - comment - 17 Jan 2018

See #19216

if (!$categoryId === null)

lets do it all the same way

avatar Quy
Quy - comment - 17 Jan 2018

!$this->_children === null does not execute the if statement at all.

$this->_children !== null always execute even if there are no subcategories.

		if ($this->_children !== null)
		{
			$params = $this->getState()->get('params');

			$orderByPri = $params->get('orderby_pri');

			if ($orderByPri === 'alpha' || $orderByPri === 'ralpha')
			{
				$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($orderByPri === 'alpha') ? 1 : (-1));
			}
		}
avatar csthomas
csthomas - comment - 18 Jan 2018

IMO you can use if ($this->_children), count() is not needed. Value of $this->_children could be false, null or array.

avatar zero-24
zero-24 - comment - 19 Jan 2018

I have tested this item successfully on 4882a1f

?

Just a quick note when you are testing on complete new install you need this URL to trigger the error:

http://localhost/{your-path}/index.php/archived-articles/2011/1/archives (adding the index.php)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19396.
avatar zero-24 zero-24 - test_item - 19 Jan 2018 - Tested successfully
avatar csthomas
csthomas - comment - 20 Jan 2018

I have tested this item successfully on 4882a1f


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

avatar csthomas csthomas - test_item - 20 Jan 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Jan 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Jan 2018

Ready to Commit after two successful tests.

avatar zero-24 zero-24 - change - 7 Feb 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-02-07 00:18:25
Closed_By zero-24
Labels Added: ?
avatar zero-24 zero-24 - close - 7 Feb 2018
avatar zero-24 zero-24 - merge - 7 Feb 2018
avatar zero-24
zero-24 - comment - 7 Feb 2018

Merged Thanks!

Add a Comment

Login with GitHub to post a comment