Jump to content

Different behaviour between \IPS\Theme::compileTemplates and \IPS\Theme::overloadHooks


Recommended Posts

Having updated my local dev environment to PHP 8.0, I'm now getting

PHP Fatal error:  Cannot use "parent" when current class scope has no parent in /var/www/html/ips_themes/system/Theme/Theme.php(2633) : eval()'d code on line 29

during the multiredirect, causing it to fall back to the manual redirect (and succeed due to the lock in compileTemplates still being held by the dead request).

This is being caused by a theme hook that is manually overriding one of the template methods

	public function userReputation($member, $types, $currentAppModule, $currentType, $table, $reactions) {
		// ... my logic
		return parent::userReputation($member, $types, $currentAppModule, $currentType, $table, $reactions);
	}

which is a supported thing to do.

This is causing problems now because as of PHP 8.0 it is a fatal compile time error if the code references `parent` but is in a class that does not have a parent.

Please can you update \IPS\Theme::compileTemplates (and \IPS\cms\Theme::compileTemplates) to avoid this, possibly by having the hook class extend \StdClass (or some other placeholder) so the compile time check passes?
 

Edited by Colonel_mortis
Link to comment
Share on other sites

2 minutes ago, Colonel_mortis said:

Hmm yeah I guess that works, would be nicer if the eval logic was changed to have it extend \StdClass or something though.

yeah, i figured this would be a good short term solution till they figured things out, but that might've been some wishful thinking on my part. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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