Upgrading from PHP 5.6 to > 7.1 the following error occurs: '0 - Using $this when not in object context'
Using Joomla debug information & Google the cause was found in line 370 of the following file: libraries\src\Application\CMSApplication.php
Changing line from : $options['app'] = $this;
To: $options['app'] = self;
Fixes the problem in the short term but at each Joomla update would seem to be over written. It would be nice to have a more permanent fix as Joomla updates are very regular.
Current Phoca Gallery is V4.3.18; Joomla is 3.9.20; PHP 7.3.5
This temporary fix works on both live server and local Wamp test site.
I am not sure whether it is a Phoca issue or Joomla - perhaps someone can advise.
Phoca Gallery error with PHP upgrade
-
- Phoca Newbie
- Posts: 3
- Joined: 18 Aug 2020, 02:07
-
- Phoca Hero
- Posts: 2819
- Joined: 28 Nov 2010, 17:20
Re: Phoca Gallery error with PHP upgrade
Hi,
Do you have the complete Call stack? Check also your template.
Kind regards
Christine
Do you have the complete Call stack? Check also your template.
Kind regards
Christine
-
- Phoca Newbie
- Posts: 3
- Joined: 18 Aug 2020, 02:07
Re: Phoca Gallery error with PHP upgrade
Here is the stack trace:
Using $this when not in object context
C:\wamp\www\paparoapress\libraries\src\Application\CMSApplication.php:370
Call stack
# Function Location
1 () JROOT\libraries\src\Application\CMSApplication.php:370
2 Joomla\CMS\Application\CMSApplication::getMenu() JROOT\libraries\src\Application\SiteApplication.php:275
3 Joomla\CMS\Application\SiteApplication::getMenu() JROOT\modules\mod_phocagallery_tree\mod_phocagallery_tree.php:34
4 include() JROOT\libraries\src\Helper\ModuleHelper.php:200
5 Joomla\CMS\Helper\ModuleHelper::renderModule() JROOT\libraries\src\Document\Renderer\Html\ModuleRenderer.php:98
6 Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render() JROOT\libraries\src\Document\Renderer\Html\ModulesRenderer.php:47
7 Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render() JROOT\libraries\src\Document\HtmlDocument.php:489
8 Joomla\CMS\Document\HtmlDocument->getBuffer() JROOT\libraries\src\Document\HtmlDocument.php:793
9 Joomla\CMS\Document\HtmlDocument->_renderTemplate() JROOT\libraries\src\Document\HtmlDocument.php:567
10 Joomla\CMS\Document\HtmlDocument->render() JROOT\libraries\src\Application\CMSApplication.php:1044
11 Joomla\CMS\Application\CMSApplication->render() JROOT\libraries\src\Application\SiteApplication.php:778
12 Joomla\CMS\Application\SiteApplication->render() JROOT\libraries\src\Application\CMSApplication.php:202
13 Joomla\CMS\Application\CMSApplication->execute() JROOT\index.php:49
Also I have found this link but in my case isn't working:
http://www.artisteer.com/?post_id=25370 ... orum_id=20
From the above you can gather this site is using an Artisteer template since 2013 and the only page (menu link) that is giving me issues is the Phoca Gallery.
Using $this when not in object context
C:\wamp\www\paparoapress\libraries\src\Application\CMSApplication.php:370
Call stack
# Function Location
1 () JROOT\libraries\src\Application\CMSApplication.php:370
2 Joomla\CMS\Application\CMSApplication::getMenu() JROOT\libraries\src\Application\SiteApplication.php:275
3 Joomla\CMS\Application\SiteApplication::getMenu() JROOT\modules\mod_phocagallery_tree\mod_phocagallery_tree.php:34
4 include() JROOT\libraries\src\Helper\ModuleHelper.php:200
5 Joomla\CMS\Helper\ModuleHelper::renderModule() JROOT\libraries\src\Document\Renderer\Html\ModuleRenderer.php:98
6 Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render() JROOT\libraries\src\Document\Renderer\Html\ModulesRenderer.php:47
7 Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render() JROOT\libraries\src\Document\HtmlDocument.php:489
8 Joomla\CMS\Document\HtmlDocument->getBuffer() JROOT\libraries\src\Document\HtmlDocument.php:793
9 Joomla\CMS\Document\HtmlDocument->_renderTemplate() JROOT\libraries\src\Document\HtmlDocument.php:567
10 Joomla\CMS\Document\HtmlDocument->render() JROOT\libraries\src\Application\CMSApplication.php:1044
11 Joomla\CMS\Application\CMSApplication->render() JROOT\libraries\src\Application\SiteApplication.php:778
12 Joomla\CMS\Application\SiteApplication->render() JROOT\libraries\src\Application\CMSApplication.php:202
13 Joomla\CMS\Application\CMSApplication->execute() JROOT\index.php:49
Also I have found this link but in my case isn't working:
http://www.artisteer.com/?post_id=25370 ... orum_id=20
From the above you can gather this site is using an Artisteer template since 2013 and the only page (menu link) that is giving me issues is the Phoca Gallery.
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Gallery error with PHP upgrade
Hi, when you update Phoca Gallery Tree module to latest version and test in another template, do you get the same problem?
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 18 Aug 2020, 02:07
Re: Phoca Gallery error with PHP upgrade
Testing with the inbuilt Joomla template produced the same result. Upgrading the 'Phoca Gallery Tree module' solved the problem. Since the Phoca gallery was installed back in 2013 I had forgotten all about the tree module.
Kind regards
Paul
Kind regards
Paul
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Gallery error with PHP upgrade
Ok
If you find Phoca extensions useful, please support the project