Page 1 of 1

PHP 8 issue with Phoca Open graph plugin

Posted: 31 Oct 2022, 16:19
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"

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 02 Nov 2022, 00:29
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

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 03 Nov 2022, 13:14
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):

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 03 Nov 2022, 13:26
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.

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 03 Nov 2022, 20:57
by Jan
Hi, try to test version 4.0.4Beta and let me know:
https://github.com/PhocaCz/PhocaOpenGra ... .4Beta.zip

Jan

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 04 Nov 2022, 09:27
by surfsimon
Hi Jan, I can confrm that this fix solves the error ;)
Many thanks for the proper and swift assistance!

Re: PHP 8 issue with Phoca Open graph plugin

Posted: 09 Nov 2022, 01:33
by Jan
Hi, thank you for the info.

Jan