Minor bug in Sourcerer Replace.php (9.2.1)

Search
Other Bug Reports questions
Forum

Minor bug in Sourcerer Replace.php (9.2.1)

Mark Bradley's Avatar Mark Bradley
Joomla 4.1.3, PHP 7.4, Sourcerer 9.2.1
Whilst investigating a display issue relating to code "managed" by Sourcerer that worked with J3.10.8, I noticed PHP Warnings being emitted in libraries/regularlabs/src/PluginTag.php at line 225:
$x = (object) [$main_key => $string];
The warning being "Illegal offset type" relating to $main_key. In this instance, the static method getAttributesFromString is passed just 2 defined parameters (of a possible 5) from plugins/system/sourcerer/src/Replace.php line 154:
$data = RL_PluginTag::getAttributesFromString($match['data'], []);
getAttributesFromString is expecting parameter 2 ($main_key) to be only a string, but in this case is given an array. I see that the default for parameter 3 ($known_boolean_keys) is [], and I see that the returned object ($data) refers to member ->raw, so I am assuming Replace.php line 154 should probably be:
$data = RL_PluginTag::getAttributesFromString($match['data'], 'raw', []);

Hope this makes sense and helps.

Mark
Peter van Westen's Avatar Peter van Westen ADMIN
Thanks. It should simply be:
$data = RL_PluginTag::getAttributesFromString($match['data']);

It is fixed in latest development release on:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in