Hi there,
I got a PHP warning message in my server logs related to jDownloader, if someone attempt to access a category wich does not (longer) exist.
I think it is related to the PHP Version 7 - I use PHP V7.1.25 with the latest Joomla V3.9.2
The Warning:
Got error 'PHP message: PHP Warning: Creating default object from empty value in /components/com_jdownloads/models/category.php on line 472
Here is the line 472 from that category.php file:$this->_children[$i]->tags->getItemTags('com_jdownloads.category', $this->_children[$i]->id);
The whole if block from line 468 to 474 is this:
if (count($this->_children)){
for ($i = 0; $i < count($this->_children); $i++) {
// Get the tags
$this->_children[$i]->tags = new JHelperTags;
$this->_children[$i]->tags->getItemTags('com_jdownloads.category', $this->_children[$i]->id);
}
}
I have made changes as a workaround to get rid of that warning:
if (count($this->_children)){
for ($i = 0; $i < count($this->_children); $i++) {
if(isset($this->_children[$i]))
{
// Get the tags
$this->_children[$i]->tags = new JHelperTags;
$this->_children[$i]->tags->getItemTags('com_jdownloads.category', $this->_children[$i]->id);
}
}
}
Because "count($this->_children)" returns 1 the block is entered, but "$this->_children[$i]" is NULL and therefore the warning occours, so I've made an extra check if the "$this->_children[$i]" is set or not.
I hope that will help.
Greetings!
Many thanks for your helpful post. ;)
I will add your fix in the next version.
Hi Arno :)
You're welcome!
Keep up the great work!
And have a good time!
Cheers!