Update a Joomla 8.10.3 Installation from PHP 7.0 to 7.1 or 7.2
Starting the Website
Normal Operation:
Withe Page with
--> Fatal Error 0 Using $this when not in object context
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
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().
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.
@mbabker I realize this is old and closed... but you just saved me a monumental amount of time. Thank you very much.
ΠΠΎΠ΄ΡΠΊΠ°ΠΆΠΈΡΠ΅, Ρ ΠΌΠ΅Π½Ρ ΡΠ°ΠΊΠ°Ρ ΠΆΠ΅ ΠΏΡΠΎΠ±Π»Π΅ΠΌΠ°, Π½ΠΎ ΡΠ°ΠΊΠΎΠ³ΠΎ ΠΊΠΎΠ΄Π° Π² index Π½Π΅Ρ. ΠΠ°ΠΊ ΡΠ΅ΡΠΈΡΡ? ΠΎΡΠΈΠ±ΠΊΠ°: Error: Call to undefined method Error::get(): Using $this when not in object context
Most helpful comment
Unfortunately this is an error in your template
JROOT/templates/aerzte_theme517/index.php:209. Basically, it's doing something likeJSite::getMenu()orJoomla\CMS\Application\SiteApplication::getMenu()which calls thegetMenumethod in a static context, which is the incorrect way of calling that method. The code should beJFactory::getApplication()->getMenu().