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