PHP 8 issue with Phoca Open graph plugin

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
surfsimon
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 31 Oct 2022, 16:07

PHP 8 issue with Phoca Open graph plugin

Post by surfsimon »

I am using the Open graph plugin on a site with books, where the books are Joomla categories and the chapters are articles from that specific category. In the category I have set up an image, the articles do not have an actual image. In Yootheme, the category image is displayed inside the article (using dynamic conditions).

For open graph, I also add the category image, and I have achieved this with the setting "Display Category Image In Article" under the tab Extra options. However, I noticed activating that option throws a fatal error on PHP 8.0 and up. Apart from this option, the plugin works fine on PHP 8.
Is this something that can be fixed?
The actual error I get is the following:
"0: Attempt to assign property "image_intro" on null"

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 issue with Phoca Open graph plugin

Post by Jan »

Hi, can you enable debug mode to see in which file and on which row the problem occurs?

Which Phoca Open Graph plugin do you use? (system or content), which version?

Thank you, Jan
If you find Phoca extensions useful, please support the project
surfsimon
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 31 Oct 2022, 16:07

Re: PHP 8 issue with Phoca Open graph plugin

Post by surfsimon »

Hi Jan,
I use the Phoca Open Graph Content Plugin. I saw I had version 4.0.3, while I saw on the downloads for the plugin you only offer 4.0.2, so just to be sure I installed that version as well (indeed in Extension manager now it shows version 4.0.2), but the error remained. See here a screenshot with the version showing: https://tinyurl.com/26d7f9c8

Debug mode is also affected by the error it seems, it doesn't show on the page in error (while on the other pages of the site it shows). But I enabled logging as well, and there I see the following sequence after every occurance of the error:

2022-11-03 07:30:50 error 82.170.169.237 guest PDC controller onError before canRun() /home/customer/www/example.com/public_html/plugins/content/phocaopengraph/phocaopengraph.php::587 Attempt to assign property "image_intro" on null #0 /home/customer/www/example.com/public_html/libraries/src/Plugin/CMSPlugin.php(279): plgContentPhocaOpenGraph->onContentBeforeDisplay('com_content.cat...', Object(stdClass), Object(Joomla\Registry\Registry), 0)
#1 /home/customer/www/example.com/public_html/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}(Object(Joomla\Event\Event))
#2 /home/customer/www/example.com/public_html/libraries/src/Application/EventAware.php(107): Joomla\Event\Dispatcher->dispatch('onContentBefore...', Object(Joomla\Event\Event))
#3 /home/customer/www/example.com/public_html/components/com_content/src/View/Category/HtmlView.php(116): Joomla\CMS\Application\WebApplication->triggerEvent('onContentBefore...', Array)
#4 /home/customer/www/example.com/public_html/libraries/src/MVC/Controller/BaseController.php(639): Joomla\Component\Content\Site\View\Category\HtmlView->display()
#5 /home/customer/www/example.com/public_html/components/com_content/src/Controller/DisplayController.php(121): Joomla\CMS\MVC\Controller\BaseController->display(true, Array)
#6 /home/customer/www/example.com/public_html/libraries/src/MVC/Controller/BaseController.php(672): Joomla\Component\Content\Site\Controller\DisplayController->display()
#7 /home/customer/www/example.com/public_html/libraries/src/Dispatcher/ComponentDispatcher.php(143): Joomla\CMS\MVC\Controller\BaseController->execute('display')
#8 /home/customer/www/example.com/public_html/components/com_content/src/Dispatcher/Dispatcher.php(56): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()
#9 /home/customer/www/example.com/public_html/libraries/src/Component/ComponentHelper.php(355): Joomla\Component\Content\Site\Dispatcher\Dispatcher->dispatch()
#10 /home/customer/www/example.com/public_html/libraries/src/Application/SiteApplication.php(200): Joomla\CMS\Component\ComponentHelper::renderComponent('com_content')
#11 /home/customer/www/example.com/public_html/libraries/src/Application/SiteApplication.php(241): Joomla\CMS\Application\SiteApplication->dispatch()
#12 /home/customer/www/example.com/public_html/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\SiteApplication->doExecute()
#13 /home/customer/www/example.com/public_html/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#14 /home/customer/www/example.com/public_html/index.php(32): require_once('/home/customer/...')
#15 {main}

See next post for the rest of the errors (maximum number of characters used for this post):
surfsimon
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 31 Oct 2022, 16:07

Re: PHP 8 issue with Phoca Open graph plugin

Post by surfsimon »

Second part of the error:

2022-11-03 07:30:50 error 82.170.169.237 guest PDC onError Stored error /home/customer/www/example.com/public_html/plugins/content/phocaopengraph/phocaopengraph.php::587 Attempt to assign property "image_intro" on null #0 /home/customer/www/example.com/public_html/libraries/src/Plugin/CMSPlugin.php(279): plgContentPhocaOpenGraph->onContentBeforeDisplay('com_content.cat...', Object(stdClass), Object(Joomla\Registry\Registry), 0)
#1 /home/customer/www/example.com/public_html/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}(Object(Joomla\Event\Event))
#2 /home/customer/www/example.com/public_html/libraries/src/Application/EventAware.php(107): Joomla\Event\Dispatcher->dispatch('onContentBefore...', Object(Joomla\Event\Event))
#3 /home/customer/www/example.com/public_html/components/com_content/src/View/Category/HtmlView.php(116): Joomla\CMS\Application\WebApplication->triggerEvent('onContentBefore...', Array)
#4 /home/customer/www/example.com/public_html/libraries/src/MVC/Controller/BaseController.php(639): Joomla\Component\Content\Site\View\Category\HtmlView->display()
#5 /home/customer/www/example.com/public_html/components/com_content/src/Controller/DisplayController.php(121): Joomla\CMS\MVC\Controller\BaseController->display(true, Array)
#6 /home/customer/www/example.com/public_html/libraries/src/MVC/Controller/BaseController.php(672): Joomla\Component\Content\Site\Controller\DisplayController->display()
#7 /home/customer/www/example.com/public_html/libraries/src/Dispatcher/ComponentDispatcher.php(143): Joomla\CMS\MVC\Controller\BaseController->execute('display')
#8 /home/customer/www/example.com/public_html/components/com_content/src/Dispatcher/Dispatcher.php(56): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()
#9 /home/customer/www/example.com/public_html/libraries/src/Component/ComponentHelper.php(355): Joomla\Component\Content\Site\Dispatcher\Dispatcher->dispatch()
#10 /home/customer/www/example.com/public_html/libraries/src/Application/SiteApplication.php(200): Joomla\CMS\Component\ComponentHelper::renderComponent('com_content')
#11 /home/customer/www/example.com/public_html/libraries/src/Application/SiteApplication.php(241): Joomla\CMS\Application\SiteApplication->dispatch()
#12 /home/customer/www/example.com/public_html/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\SiteApplication->doExecute()
#13 /home/customer/www/example.com/public_html/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#14 /home/customer/www/example.com/public_html/index.php(32): require_once('/home/customer/...')
#15 {main}

Hopefully this helps, but let me know what else I can do to assist.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 issue with Phoca Open graph plugin

Post by Jan »

Hi, try to test version 4.0.4Beta and let me know:
https://github.com/PhocaCz/PhocaOpenGra ... .4Beta.zip

Jan
If you find Phoca extensions useful, please support the project
surfsimon
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 31 Oct 2022, 16:07

Re: PHP 8 issue with Phoca Open graph plugin

Post by surfsimon »

Hi Jan, I can confrm that this fix solves the error ;)
Many thanks for the proper and swift assistance!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 issue with Phoca Open graph plugin

Post by Jan »

Hi, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply