? ?
avatar HLeithner
HLeithner
24 Nov 2020

Steps to reproduce the issue

  • Blog layout showing category "uncategoriesed" with an article.
  • Null object Warning is visible

Expected result

No Error

Actual result

Warning: Attempt to read property "id" on null in components/com_content/views/category/view.html.php on line 270

System information (as much as possible)

3.9.23 with php8-rc5

Additional comments

Maybe only a php8 issue

avatar HLeithner HLeithner - open - 24 Nov 2020
avatar joomla-cms-bot joomla-cms-bot - change - 24 Nov 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Nov 2020
avatar chmst
chmst - comment - 29 Dec 2020

Trying to reproduce this in php 8 , J3.9.23, but I don't get a notice.


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

avatar bembelimen bembelimen - change - 8 Jan 2021
Labels Added: ?
avatar bembelimen bembelimen - labeled - 8 Jan 2021
avatar PhilETaylor
PhilETaylor - comment - 8 Jan 2021

I get this. PHP 8.0.2-dev. Joomla 4 beta 6

Screenshot 2021-01-08 at 23 30 24

My set up was for #31925 and then I just clicked the Category that was linked to http://127.0.0.1/index.php?view=category&id=2

avatar rjharishabh
rjharishabh - comment - 18 Mar 2021

@PhilETaylor where can find Joomla 4 repo.
I have cloned Joomla 3.x repo, but I want to work on some known issues related to Joomla 4.x

avatar drmenzelit
drmenzelit - comment - 18 Mar 2021

After cloning you need to check out the 4.0 branch

avatar rjharishabh
rjharishabh - comment - 18 Mar 2021

Thanks sir

avatar pank1999
pank1999 - comment - 19 Mar 2021

i want to contribute and try to resolve this issue please assign this task to me

avatar alikon
alikon - comment - 19 Mar 2021

unable to replicate this with php 8 in 3.9.26-dev

avatar joomdonation
joomdonation - comment - 20 Mar 2021

@PhilETaylor Could you please check to see if you still get this error with latest Joomla 4.0-dev? I could not re-procedure this issue anymore

avatar PhilETaylor
PhilETaylor - comment - 20 Mar 2021

I cannot replicate this, in todays (8f9fac6) Joomla staging branch, based on the "Steps to reproduce the issue" provided by @HLeithner in opening this issue last year.

However, This same problem was reported by me in Joomla 4 (#31925) and was replicated by others and ultimately fixed (#32027) in Joomla 4 in January 2021

The fix used there was to cast to (int)

As its complaining that $category is null, and as $category is derived from $category = $this->category->getParent(); we have to assume that the Uncategorised category parent is not ROOT like it should be in a normal set up.

I have exhaustively tested this, making wild assumptions, deleting the root category etc, and I have been unable to replicate it in Joomla staging today.

As this report was made on 24th November 2020 I have reverted to the commit 435d780 which was on that day, which was also the "Prepare Joomla! 3.9.23 release" commit to test as well.

Using that commit, and my current custom PHP 8.0.3 version, with full error reporting set to development in Joomla and maximum in PHP.ini I am unable to replicate this issue at all.

avatar joomdonation
joomdonation - comment - 21 Mar 2021

@PhilETaylor Actually, after looking carefully at the code, I can re-procedure the issue myself. The error happens when there is no menu item created to one of the options:

  • List All Categories
  • Category List
  • Category Blog

And category is accessed via Articles - Categories module. The actual error causes by some changes in php 8:

  • Before php 8: $cateogory->id > 1 return false for root category ($category->id has value 'root')
  • With php 8, $cateogory->id > 1 return true for root category, so the code inside if block runs and we have the warning.
avatar joomdonation
joomdonation - comment - 21 Mar 2021

So I made two PRs: one for staging #32767 and one for 4.0-dev #32768 . We can close this issue now.

avatar alikon alikon - change - 21 Mar 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-03-21 06:59:27
Closed_By alikon
Labels Added: ?
Removed: ?
avatar alikon alikon - close - 21 Mar 2021
avatar alikon
alikon - comment - 21 Mar 2021

please test #32767 and #32768

Add a Comment

Login with GitHub to post a comment