Sourcere seems toe be reusing the $article...

Search
Other Bug Reports questions
Forum

Sourcere seems toe be reusing the $article variable

Milan Litvan's Avatar Milan Litvan
Hi,

We are using Sourcerer for generating article introtexts in our "product" catalogue. All articles then use this simple template:
{source}<?php require 'includes/article-intro.php'; ?>{/source}<hr id="system-readmore">{loadmoduleid 1234}

Than we have a menu item of Category Blog type pointing to a product root category. This should render a list of article stubs where the introtext part is genereted by the includes/article-intro.php included by sourcerer (the included file uses $article variable for title, finding custom fields etc.).

This is working as expected in Joomla 3 both in Category Blog and other modules that work with article introtexts.

However in joomla 4 we are experiencing a weird bug where all article stubs display the same generated content.

Although I am not 100% sure, I think the problem is in RegularLabs\Library\Php which passes the self::$rl_variables to the function genereated by Sourcerer. After the first execution, the $article passed to RegularLabs\Library\Php::execute() is stored in self::$rl_variables and on subsequent executions this stored article overwrites the one passed to RegularLabs\Library\Php::execute().

I have tried to add unset($rl_variables["article"]); to init code, in RegularLabs\Library\Php::generateFileContents() and "it" started to work as expected.

Thanks in advance
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Milan Litvan's Avatar Milan Litvan
This development version is working as expected. Thank you very much for the quick fix.
Peter van Westen's Avatar Peter van Westen ADMIN
Ok, great 🙂
The fix will be included in the next release.
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in