Page 1 of 1

Phoca Gallery error with PHP upgrade

Posted: 18 Aug 2020, 02:31
by pedlin
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.

Re: Phoca Gallery error with PHP upgrade

Posted: 18 Aug 2020, 18:04
by christine
Hi,

Do you have the complete Call stack? Check also your template.

Kind regards
Christine

Re: Phoca Gallery error with PHP upgrade

Posted: 19 Aug 2020, 02:37
by pedlin
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.

Re: Phoca Gallery error with PHP upgrade

Posted: 19 Aug 2020, 13:28
by Jan
Hi, when you update Phoca Gallery Tree module to latest version and test in another template, do you get the same problem?

Jan

Re: Phoca Gallery error with PHP upgrade

Posted: 20 Aug 2020, 04:53
by pedlin
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

Re: Phoca Gallery error with PHP upgrade

Posted: 25 Aug 2020, 14:28
by Jan
Ok