No Code Attached Yet
avatar brbrbr
brbrbr
10 Apr 2025

Is your feature request related to a problem? Please describe.

A misfunctioning extension can easily make a Joomla website inaccessible.
If it is a system plugin the administrator will fail too, making it impossible to fix the problem.

Describe the solution you'd like

wrap booting an extension (especially plugins) in a try - catch

 public function bootPlugin($plugin, $type): PluginInterface
    {
        // Normalize the plugin name
        $plugin = strtolower($plugin);
        $plugin = str_starts_with($plugin, 'plg_') ? substr($plugin, 4) : $plugin;

        // Path to look for services
        $path = JPATH_SITE . '/plugins/' . $type . '/' . $plugin;
        try {
            return $this->loadExtension(PluginInterface::class, $plugin . ':' . $type, $path);
        } catch (\Error $e) {
            Factory::getApplication()->enqueueMessage($e->getMessage(),'error');
            //behave like plugin not found.
            $dispatcher = $this->getContainer()->get(DispatcherInterface::class);
            return new DummyPlugin($dispatcher);
        }
    }

Additional context

avatar brbrbr brbrbr - open - 10 Apr 2025
avatar joomla-cms-bot joomla-cms-bot - change - 10 Apr 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Apr 2025

Add a Comment

Login with GitHub to post a comment