New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PHP to 7.1 / 7.2 creates "Fatal Error 0 Using $this when not in object context" #21258

Closed
solenthaler opened this Issue Jul 25, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@solenthaler
Copy link

solenthaler commented Jul 25, 2018

Steps to reproduce the issue

Update a Joomla 8.10.3 Installation from PHP 7.0 to 7.1 or 7.2
Starting the Website

Expected result

Normal Operation:

Actual result

Withe Page with
--> Fatal Error 0 Using $this when not in object context

System information (as much as possible)

Call stack

Function Location
1 ()JROOT/libraries/src/Application/CMSApplication.php:369
2 Joomla\CMS\Application\CMSApplication::getMenu() JROOT/libraries/src/Application/SiteApplication.php:275
3 Joomla\CMS\Application\SiteApplication::getMenu() JROOT/templates/aerzte_theme517/index.php:209
4 require() JROOT/libraries/src/Document/HtmlDocument.php:658
5 Joomla\CMS\Document\HtmlDocument->_loadTemplate() JROOT/libraries/src/Document/HtmlDocument.php:720
6 Joomla\CMS\Document\HtmlDocument->_fetchTemplate() JROOT/libraries/src/Document/HtmlDocument.php:535
7 Joomla\CMS\Document\HtmlDocument->parse() JROOT/libraries/src/Application/CMSApplication.php:1027
8 Joomla\CMS\Application\CMSApplication->render() JROOT/libraries/src/Application/SiteApplication.php:780
9 Joomla\CMS\Application\SiteApplication->render() JROOT/libraries/src/Application/CMSApplication.php:201
10 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49

Additional comments

@mbabker

This comment has been minimized.

Copy link
Member

mbabker commented Jul 25, 2018

Unfortunately this is an error in your template JROOT/templates/aerzte_theme517/index.php:209. Basically, it's doing something like JSite::getMenu() or Joomla\CMS\Application\SiteApplication::getMenu() which calls the getMenu method in a static context, which is the incorrect way of calling that method. The code should be JFactory::getApplication()->getMenu().

@mbabker mbabker closed this Jul 25, 2018

@davietechfl

This comment has been minimized.

Copy link

davietechfl commented Oct 21, 2018

Thank you, just worked for me on a Joomla site, changed the file as specified and site returned to normal opeation on PHP 7.1. Joomla recommended the update but without your change to the index.php site would not display, much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment