problem using Phoca PDF and 4SEO

Phoca PDF - creating PDF documents in Joomla! CMS
theant
Phoca Member
Phoca Member
Posts: 16
Joined: 18 Feb 2009, 13:02

problem using Phoca PDF and 4SEO

Post by theant »

Hello
there is a problem using Phoca PDF and 4SEO. After installation of Phoca plugin I don't get og:image tag anymore.
Looking at error log I see a lot of errors like these:

Code: Select all

DATE	TIME	TYPE	IP	USER	MESSAGE
6
2024-05-17	03:40:15	error	18.191.223.206	guest	PDC controller onError before canRun() /web/htdocs/www.vorrei.org/home/libraries/src/Cache/Controller/CallbackController.php::106 Call to undefined method Joomla\CMS\Document\PdfDocument::resetHeadData() #0 /web/htdocs/www.vorrei.org/home/libraries/src/Helper/ModuleHelper.php(592): Joomla\CMS\Cache\Controller\CallbackController->get()
7
#1 /web/htdocs/www.vorrei.org/home/modules/mod_articles_category/src/Dispatcher/Dispatcher.php(78): Joomla\CMS\Helper\ModuleHelper::moduleCache()
8
#2 /web/htdocs/www.vorrei.org/home/libraries/src/Dispatcher/AbstractModuleDispatcher.php(63): Joomla\Module\ArticlesCategory\Site\Dispatcher\Dispatcher->getLayoutData()
9
#3 /web/htdocs/www.vorrei.org/home/libraries/src/Helper/ModuleHelper.php(281): Joomla\CMS\Dispatcher\AbstractModuleDispatcher->dispatch()
10
#4 /web/htdocs/www.vorrei.org/home/libraries/src/Helper/ModuleHelper.php(161): Joomla\CMS\Helper\ModuleHelper::renderRawModule()
11
#5 /web/htdocs/www.vorrei.org/home/libraries/src/Document/Renderer/Pdf/ModuleRenderer.php(99): Joomla\CMS\Helper\ModuleHelper::renderModule()
12
#6 /web/htdocs/www.vorrei.org/home/plugins/content/loadmodule/src/Extension/LoadModule.php(186): Joomla\CMS\Document\Renderer\Pdf\ModuleRenderer->render()


I disabled the PhocaPDF system plugin for a second and the og:image tag appears immediatly.

Yannick Gaultier suggested me to report that exact error to you at Phoca, «he'll fix that very quickly» he said.

Best regards
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: problem using Phoca PDF and 4SEO

Post by Jan »

Hi, which version of Phoca PDF and which version of Joomla do you run?

Try to test:
/var/www/phoca82.test/J5/libraries/src/Document/PdfDocument.php

and add following method to this class, e.g. on line cca 155

Code: Select all

public function resetHeadData($types = null)
    {
        if (\is_null($types)) {
            $this->title         = '';
            $this->description   = '';
            $this->link          = '';
            $this->_metaTags     = [];
            $this->_links        = [];
            $this->_styleSheets  = [];
            $this->_style        = [];
            $this->_scripts      = [];
            $this->_script       = [];
            $this->_custom       = [];
            $this->scriptOptions = [];
        }

        if (\is_array($types)) {
            foreach ($types as $type) {
                $this->resetHeadDatum($type);
            }
        }

        if (\is_string($types)) {
            $this->resetHeadDatum($types);
        }

        return $this;
    }
and let me know if this is OK?

Jan
If you find Phoca extensions useful, please support the project
theant
Phoca Member
Phoca Member
Posts: 16
Joined: 18 Feb 2009, 13:02

Re: problem using Phoca PDF and 4SEO

Post by theant »

Hi
it's Joomla 4.4.4 and Phoca PDF 5.0.0 (Phoca PDF Content Plugin 5.0.2).
I added the code to src/Document/PdfDocument.php
but there are still some errors

Code: Select all

2024-05-18	09:54:15	error	3.144.222.53	guest	PDC controller onError before canRun() /web/htdocs/www.vorrei.org/home/libraries/src/Document/PdfDocument.php::184 syntax error, unexpected token "and", expecting "function" or "const" #0 /web/htdocs/www.vorrei.org/home/libraries/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()

578

#1 /web/htdocs/www.vorrei.org/home/libraries/src/Autoload/ClassLoader.php(59): Composer\Autoload\ClassLoader->loadClass()

579

#2 [internal function]: Joomla\CMS\Autoload\ClassLoader->loadClass()

580

#3 /web/htdocs/www.vorrei.org/home/libraries/src/Document/Factory.php(45): class_exists()

581

#4 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(786): Joomla\CMS\Document\Factory->createDocument()

582

#5 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(338): Joomla\CMS\Factory::createDocument()

583

#6 /web/htdocs/www.vorrei.org/home/libraries/src/Application/WebApplication.php(278): Joomla\CMS\Factory::getDocument()

584

#7 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(43): Joomla\CMS\Application\WebApplication->loadDocument()

585

#8 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(149): RegularLabs\Library\Document::get()

586

#9 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(446): RegularLabs\Library\Document::isFeed()

587

#10 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(411): RegularLabs\Library\SystemPlugin->passPageTypes()

588

#11 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(174): RegularLabs\Library\SystemPlugin->passChecks()

589

#12 /web/htdocs/www.vorrei.org/home/libraries/src/Plugin/CMSPlugin.php(289): RegularLabs\Library\SystemPlugin->onAfterRoute()

590

#13 /web/htdocs/www.vorrei.org/home/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()

591

#14 /web/htdocs/www.vorrei.org/home/libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()

592

#15 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(790): Joomla\CMS\Application\WebApplication->triggerEvent()

593

#16 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(232): Joomla\CMS\Application\SiteApplication->route()

594

#17 /web/htdocs/www.vorrei.org/home/libraries/src/Application/CMSApplication.php(293): Joomla\CMS\Application\SiteApplication->doExecute()

595

#18 /web/htdocs/www.vorrei.org/home/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()

596

#19 /web/htdocs/www.vorrei.org/home/index.php(32): require_once('...')

597

#20 {main}

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

Re: problem using Phoca PDF and 4SEO

Post by Jan »

Hi, this is a syntax error in some file and such should not have any dependency to Phoca PDF :idea:

I don't see any Phoca part in the trace :idea:

Jan
If you find Phoca extensions useful, please support the project
theant
Phoca Member
Phoca Member
Posts: 16
Joined: 18 Feb 2009, 13:02

Re: problem using Phoca PDF and 4SEO

Post by theant »

Jan, thanks for reply.
maybe these other errors can be helpful in understanding the cause:

Code: Select all

DATE	TIME	TYPE	IP	USER	MESSAGE
2024-05-21	02:05:52	error	66.249.64.72	guest	PDC controller onError before canRun() /web/htdocs/www.vorrei.org/home/libraries/src/Document/PdfDocument.php::184 syntax error, unexpected token "and", expecting "function" or "const" #0 /web/htdocs/www.vorrei.org/home/libraries/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#1 /web/htdocs/www.vorrei.org/home/libraries/src/Autoload/ClassLoader.php(59): Composer\Autoload\ClassLoader->loadClass()
#2 [internal function]: Joomla\CMS\Autoload\ClassLoader->loadClass()
#3 /web/htdocs/www.vorrei.org/home/libraries/src/Document/Factory.php(45): class_exists()
#4 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(786): Joomla\CMS\Document\Factory->createDocument()
#5 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(338): Joomla\CMS\Factory::createDocument()
#6 /web/htdocs/www.vorrei.org/home/libraries/src/Application/WebApplication.php(278): Joomla\CMS\Factory::getDocument()
#7 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(43): Joomla\CMS\Application\WebApplication->loadDocument()
#8 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(149): RegularLabs\Library\Document::get()
#9 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(446): RegularLabs\Library\Document::isFeed()
#10 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(411): RegularLabs\Library\SystemPlugin->passPageTypes()
#11 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(174): RegularLabs\Library\SystemPlugin->passChecks()
#12 /web/htdocs/www.vorrei.org/home/libraries/src/Plugin/CMSPlugin.php(289): RegularLabs\Library\SystemPlugin->onAfterRoute()
#13 /web/htdocs/www.vorrei.org/home/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()
#14 /web/htdocs/www.vorrei.org/home/libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()
#15 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(790): Joomla\CMS\Application\WebApplication->triggerEvent()
#16 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(232): Joomla\CMS\Application\SiteApplication->route()
#17 /web/htdocs/www.vorrei.org/home/libraries/src/Application/CMSApplication.php(293): Joomla\CMS\Application\SiteApplication->doExecute()
#18 /web/htdocs/www.vorrei.org/home/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#19 /web/htdocs/www.vorrei.org/home/index.php(32): require_once('...')
#20 {main}
2024-05-21	02:11:19	error	18.221.83.60	guest	PDC controller onError before canRun() /web/htdocs/www.vorrei.org/home/libraries/src/Document/PdfDocument.php::184 syntax error, unexpected token "and", expecting "function" or "const" #0 /web/htdocs/www.vorrei.org/home/libraries/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#1 /web/htdocs/www.vorrei.org/home/libraries/src/Autoload/ClassLoader.php(59): Composer\Autoload\ClassLoader->loadClass()
#2 [internal function]: Joomla\CMS\Autoload\ClassLoader->loadClass()
#3 /web/htdocs/www.vorrei.org/home/libraries/src/Document/Factory.php(45): class_exists()
#4 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(786): Joomla\CMS\Document\Factory->createDocument()
#5 /web/htdocs/www.vorrei.org/home/libraries/src/Factory.php(338): Joomla\CMS\Factory::createDocument()
#6 /web/htdocs/www.vorrei.org/home/libraries/src/Application/WebApplication.php(278): Joomla\CMS\Factory::getDocument()
#7 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(43): Joomla\CMS\Application\WebApplication->loadDocument()
#8 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/Document.php(149): RegularLabs\Library\Document::get()
#9 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(446): RegularLabs\Library\Document::isFeed()
#10 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(411): RegularLabs\Library\SystemPlugin->passPageTypes()
#11 /web/htdocs/www.vorrei.org/home/libraries/regularlabs/src/SystemPlugin.php(174): RegularLabs\Library\SystemPlugin->passChecks()
#12 /web/htdocs/www.vorrei.org/home/libraries/src/Plugin/CMSPlugin.php(289): RegularLabs\Library\SystemPlugin->onAfterRoute()
#13 /web/htdocs/www.vorrei.org/home/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()
#14 /web/htdocs/www.vorrei.org/home/libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()
#15 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(790): Joomla\CMS\Application\WebApplication->triggerEvent()
#16 /web/htdocs/www.vorrei.org/home/libraries/src/Application/SiteApplication.php(232): Joomla\CMS\Application\SiteApplication->route()
#17 /web/htdocs/www.vorrei.org/home/libraries/src/Application/CMSApplication.php(293): Joomla\CMS\Application\SiteApplication->doExecute()
#18 /web/htdocs/www.vorrei.org/home/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#19 /web/htdocs/www.vorrei.org/home/index.php(32): require_once('...')
#20 {main}

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

Re: problem using Phoca PDF and 4SEO

Post by Jan »

For this type of error you don't need a trace, it says exactly what is the problem with:

"/web/htdocs/www.vorrei.org/home/libraries/src/Docum ... t.php::184 syntax error, unexpected token "and""

So on line 184 there is program syntax error, this is just simple syntax error in php which needs to be fixed.

Did you paste the code correctly, testing now, all OK. :idea:

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