Jump to content

Help with the infamous parent template issue with PHP8


Go to solution Solved by teraßyte,

Recommended Posts

@Adriano Faria

I've read the other topic from @CodingJungle where you guys were discussing the infamous parent error with PHP8:

Quote

PHP Fatal error:  Cannot use "parent" when current class scope has no parent in /system/Theme/Theme.php(2703) : eval()'d code on line 137

Our install has several custom-made apps and plugins, and the developer @newbie LAC is MIA since the beginning of the Covid pandemic (and I fear for the worst, as I tried, unsuccessfully, contacting him via email a few times). Since we want to preserve all these plugins, I have to fix all of these errors myself before moving to PHP8 in production, which is quite annoying. I will post below the issue I am having with one specific plugin, so maybe you guys can help me out fixing the issue and, hopefuly, once I understand how to fix this, I will be able to replicate the fix to all other plugins that are throwing the same error.

As seen in the log above, the error is thrown in line 137, which reads as:

$whosOnline = parent::whosOnline($members, $memberCount, $guests, $anonymous, $orientation);

I've tried to surround this statement with what you suggested in the other topic, at no avail:

if( \is_callable( 'parent::whosOnline' ) )
	{
	$whosOnline = parent::whosOnline($members, $memberCount, $guests, $anonymous, $orientation);
	return $whosOnline;
    }

If you could help me out it would be super.

I am attaching the hook file to this post for your evaluation.

Thanks.

nbBotsInOnlineListTplWhosOnline.php

Edited by Gabriel Torres
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...