?
avatar chmst
chmst
2 Apr 2019

Steps to reproduce the issue

Install a fresh version.
Then go to com_content, categories, trash and delete the category.

Expected result

A warning, something like "Delete not possible. You must have at least one category"

Actual result

The category is deleted.
The view artices now throws the error:
Argument 1 passed to Joomla\Utilities\ArrayHelper::getColumn() must be of the type array, boolean given, called in administrator\components\com_content\Model\ArticlesModel.php on line 516

Additional comments

All versions and probably all extensions which use categories

avatar chmst chmst - open - 2 Apr 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2019
Status New Discussion
avatar mbabker
mbabker - comment - 2 Apr 2019

Nothing says that there must be at least one category.

Actually, that specific error at that specific line means that nobody is doing error checking in the getTransitions method, a common missing thing in Joomla's code. The getItems doc block clearly indicates a boolean false is returned on failure.

avatar brianteeman
brianteeman - comment - 2 Apr 2019

As you can create a category on the fly within the article edit form there shouldnt be a reason that you cannot delete all empty categories

avatar chmst chmst - change - 2 Apr 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-04-02 15:31:12
Closed_By chmst
avatar chmst
chmst - comment - 2 Apr 2019

@brianteeman you are right.
@mbabker After a new installation this error has diappeared. Sorry for wrong alert.

avatar chmst chmst - close - 2 Apr 2019
avatar mbabker
mbabker - comment - 2 Apr 2019

There's still a bug to be addressed and something should be open (either this with the title corrected or a new item) to address it. This line does not check for a boolean false return, meaning there is no error handling and that should be fixed to prevent the fatal error you posted in your original post.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Apr 2019

@chmst can you please open an Issue as @mbabker suggested above?

avatar chmst chmst - change - 2 Apr 2019
Status Closed New
Closed_Date 2019-04-02 15:31:12
Closed_By chmst
avatar chmst chmst - reopen - 2 Apr 2019
avatar alikon
alikon - comment - 2 Apr 2019

unable to replicate with

  • Install a fresh latest staging without data
  • go to com_content, categories
  • trash and delete the category

both
..index.php?option=com_content

and
...index.php?option=com_categories&extension=com_content

gives expected result
No Matching Results

what i'm missing ?

avatar mbabker
mbabker - comment - 2 Apr 2019

The title is not relevant at this point. As I noted in #24452 (comment) the bug is the lack of error checking when calling $this->getItems(), if for some reason that returns a boolean false that scenario is not accounted for which results in the "Argument 1 passed to Joomla\Utilities\ArrayHelper::getColumn() must be of the type array, boolean given, called in administrator\components\com_content\Model\ArticlesModel.php on line 516" fatal error from the original issue post. You're not going to replicate this issue without breaking something else.

avatar chmst
chmst - comment - 2 Apr 2019

As I said, the error has diappeard after a new installation. Probably it was a database update between the last pulls which caused the error.

avatar alikon
alikon - comment - 2 Apr 2019

did you mean after

something like

if (!$items)
{
	return false;
}

?

avatar mbabker
mbabker - comment - 2 Apr 2019

Right.

avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-04-02 17:51:28
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2019
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 2 Apr 2019
avatar joomla-cms-bot
joomla-cms-bot - comment - 2 Apr 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Apr 2019

closed as having Pull Request #24458

avatar chmst chmst - change - 4 Apr 2019
Title
At least one category must exist in com_articles and other components
[4.0] Error when there is no category in articles
avatar chmst chmst - edited - 4 Apr 2019

Add a Comment

Login with GitHub to post a comment