0

Search
Other Bug Reports questions
Forum

0 - syntax error, unexpected identifier "font"

Jan Krieghoff's Avatar Jan Krieghoff
Hi @all,

after the last update today of Regular Labs Sourcerer, I get the following error message on some pages:
syntax error, unexpected identifier "font"

Call stack
#	Function	Location
1	()	JROOT/tmp/regularlabs/custom_php/29356_9aaa0723b7d945abb6ebce33c8798221:11
2	RegularLabs\Library\Php::createFunctionInMemory()	JROOT/libraries/regularlabs/src/Php.php:206
3	RegularLabs\Library\Php::getFunctionName()	JROOT/libraries/regularlabs/src/Php.php:30
4	RegularLabs\Library\Php::execute()	JROOT/plugins/system/sourcerer/src/Replace.php:732
5	RegularLabs\Plugin\System\Sourcerer\Replace::replaceTagsPHP()	JROOT/plugins/system/sourcerer/src/Replace.php:502
6	RegularLabs\Plugin\System\Sourcerer\Replace::replaceTagsByType()	JROOT/plugins/system/sourcerer/src/Replace.php:385
7	RegularLabs\Plugin\System\Sourcerer\Replace::replaceTags()	JROOT/plugins/system/sourcerer/src/Replace.php:258
8	RegularLabs\Plugin\System\Sourcerer\Replace::handleMatch()	JROOT/plugins/system/sourcerer/src/Replace.php:59
9	RegularLabs\Plugin\System\Sourcerer\Replace::replace()	JROOT/plugins/system/sourcerer/sourcerer.php:101
10	PlgSystemSourcerer->handleOnContentPrepare()	JROOT/libraries/regularlabs/src/SystemPlugin.php:244
11	RegularLabs\Library\SystemPlugin->onContentPrepare()	JROOT/libraries/src/Plugin/CMSPlugin.php:284
12	Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()	JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:486
13	Joomla\Event\Dispatcher->dispatch()	JROOT/libraries/src/Application/EventAware.php:111
14	Joomla\CMS\Application\WebApplication->triggerEvent()	JROOT/libraries/src/HTML/Helpers/Content.php:50
15	Joomla\CMS\HTML\Helpers\Content::prepare()	JROOT/libraries/src/HTML/HTMLHelper.php:292
16	Joomla\CMS\HTML\HTMLHelper::call()	JROOT/libraries/src/HTML/HTMLHelper.php:146
17	Joomla\CMS\HTML\HTMLHelper::_()	JROOT/modules/mod_custom/mod_custom.php:19
18	include()	JROOT/libraries/src/Dispatcher/ModuleDispatcher.php:52
19	Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}()	JROOT/libraries/src/Dispatcher/ModuleDispatcher.php:55
20	Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch()	JROOT/libraries/src/Helper/ModuleHelper.php:281
21	Joomla\CMS\Helper\ModuleHelper::renderRawModule()	JROOT/libraries/src/Helper/ModuleHelper.php:161
22	Joomla\CMS\Helper\ModuleHelper::renderModule()	JROOT/libraries/src/Document/Renderer/Html/ModuleRenderer.php:99
23	Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render()	JROOT/libraries/src/Document/Renderer/Html/ModulesRenderer.php:50
24	Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render()	JROOT/libraries/src/Document/HtmlDocument.php:566
25	Joomla\CMS\Document\HtmlDocument->getBuffer()	JROOT/libraries/src/Document/HtmlDocument.php:853
26	Joomla\CMS\Document\HtmlDocument->_renderTemplate()	JROOT/libraries/src/Document/HtmlDocument.php:638
27	Joomla\CMS\Document\HtmlDocument->render()	JROOT/libraries/src/Application/CMSApplication.php:1025
28	Joomla\CMS\Application\CMSApplication->render()	JROOT/libraries/src/Application/SiteApplication.php:724
29	Joomla\CMS\Application\SiteApplication->render()	JROOT/libraries/src/Application/CMSApplication.php:298
30	Joomla\CMS\Application\CMSApplication->execute()	JROOT/includes/app.php:61
31	require_once()	JROOT/index.php:32


Is there a fix for this problem?
Please review this error 🙂

Regular Labs Library v23.8.26299
Sourcerer v9.8.0 [PRO]
Joomla 4.3.4

Regards
Jan
Peter van Westen's Avatar Peter van Westen ADMIN
As the error log suggest, this is an issue caused by your 'custom_php'.
So the php you have placed through Sourcerer. You are proabably placing whole php functions in there, which will causes issues when called multiples times.

Place php functions in separate files and include them in the php via include_once or require_once.
Please post a rating at the Joomla! Extensions Directory
Jan Krieghoff's Avatar Jan Krieghoff
Hi Peter, thank you for your response.

After your hint I analyzed what code is filled in the joomla textfield of custom module, where the Sourcerer tags are used.
I noticed, that my chrome extension "dark reader" is manipulating the text which I pasted in with some <span> elements. Sometimes these elements had multiple hirachies. An thats the reason for my problems. The spans only set the font color for joomla editor preview, so in text field the "<?php" has blue color for example, for whatever reason.
After I edited the code in Joomla editor manually and removed the spans, everything works fine 🙂

Subject can be closed 🙂

Regards
Jan
You can only post on this forum if you log in