Open any page.
No error.
Error: 0 Using $this when not in object context
Fix that worked for me but seems hacky: edit libraries/src/Application/CMSApplication.php:369
, change $options['app'] = $this;
to $options['app'] = self;
.
Labels |
Added:
?
|
Well, that's more or less what I did and what led me to the fix described in Additional comments:
Fix that worked for me but seems hacky: edit
libraries/src/Application/CMSApplication.php:369
, change$options['app'] = $this;
to$options['app'] = self;
.
As this relevant code is in the joomla application, I thought it would belong here. As I do have a fix, I supposedly do not need the forum. I do not mind closing this issue if you think it is an irrelevant bug / related to some plugin combination.
The issue is related to how an extension is calling the getMenu()
method of the application. Something is trying to call it in a static context (probably JSite::getMenu()
or JApplicationSite::getMenu()
), and static contexts do not have a $this
variable. The correct way to call the method is generally JFactory::getApplication()->getMenu()
.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-10-13 11:58:48 |
Closed_By | ⇒ | BernhardWebstudio |
okay, I see, thanks very much!
The issue is related to how an extension is calling the
getMenu()
method of the application. Something is trying to call it in a static context (probablyJSite::getMenu()
orJApplicationSite::getMenu()
), and static contexts do not have a$this
variable. The correct way to call the method is generallyJFactory::getApplication()->getMenu()
.
God bless. It has been messing with my head for the last hour or so after updating to PHP 7.2
A bit hacky indeed but it solved the issue (entire site was not functioning).
Even though it's a logical fix, I hope that it won't cause any other issues down the road.
You should ask in a Joomla forum because that's not a Joomla core issue. If you speak German you can start here to narrow down the error source/extension:
https://forum.joomla.de/thread/6467-fehler-finden-durch-detailliertere-fehlermeldung-debug-modus-call-stack/