JFactory::getDbo in tmp function with compat...

Search
Other Bug Reports questions
Forum

JFactory::getDbo in tmp function with compat plugin disabled

Bernd's Avatar Bernd
Using Joomla 5.0.3 with compat plugin disabled and Sourcerer v10.0.4

JROOT\libraries\regularlabs\src\Php.php:55 calls a function in tmp dir which calls JFactory::getDbo
This produces Error: 0 Class "JFactory" not found
Peter van Westen's Avatar Peter van Westen ADMIN
That is not a bug with Sourcerer but with you own PHP code you are executing through Sourcerer.
Please post a rating at the Joomla! Extensions Directory
Bernd's Avatar Bernd
Sorry, not Sourcerer, maybe the typo is in library in Php.php line 231:
private static function getVarInits(): array
    {
        return [
            '$app = $mainframe = RegularLabs\Library\Php::getApplication();',
            '$document = $doc = RegularLabs\Library\Php::getDocument();',
            '$database = $db = JFactory::getDbo();',
            '$user = $app->getIdentity() ?: JFactory::getUser();',
            '$Itemid = $app->getInput()->getInt(\'Itemid\');',
        ];
    }
I changed the line to
'$database = $db = $app->get(DatabaseInterface::class);',
Dont know if this is technically correct, but this works.

Thank you very much for your high quality extensions.
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
Bernd's Avatar Bernd
Thank you, latest development version works.
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