Router error on multilingual Joomla 4 website

This router parsing error is not new (the source of the image is here), but I still have to deal with it on latest Joomla! version (Joomla 4.2.2) and php 8.1 (laster version available on server).

There are 2 languages installed on Joomla 4 I was using for testing, English (the default one) and Romanian. When the articles and menus were set on English language or All languages there were everything ok, but when there was the Romanian language involved (everthing that came with domain-name.com/ro/wathever) the site was crashing with 404 page not found error because Router::parse was used in a plugin being developed. When the default language was changed from English to Romanian the problem persisted, but for the English language.

Analyzing the code I found the source of the error in the file JOOMLA_FOLDER/libraries/src/Router/Router.php: there were some path in the uri after parsing.

public function parse(&$uri, $setVars = false)
    {
        // Do the preprocess stage of the URL parse process
        $this->processParseRules($uri, self::PROCESS_BEFORE);

        // Do the main stage of the URL parse process
        $this->processParseRules($uri);

        // Do the postprocess stage of the URL parse process
        $this->processParseRules($uri, self::PROCESS_AFTER);

        // Check if all parts of the URL have been parsed.
        // Otherwise we have an invalid URL

        if (\strlen($uri->getPath()) > 0) {
            throw new RouteNotFoundException(Text::_('JERROR_PAGE_NOT_FOUND'));
        }

        if ($setVars) {
            $this->setVars($uri->getQuery(true));

            return $this->getVars();
        }

        return $uri->getQuery(true);
    }

A solution I found is to use another function, parseRawRoute, when the error was triggered, with the same (good!) result.

$uri = JUri::getInstance();
$query = array(); $router = $app->getRouter(); try { $query = $router->parse($uri); // Get the real joomla query as an array - parse current joomla link } catch (Exception $e) { $query = $router->parseRawRoute($router, $tmpuri); // Get the real joomla query as an array - parse current joomla link }

JEmbedAll, the best Joomla native extension

Purchase and download JEmbedAll, the best Joomla native extension for your improved website!

kendo tsuke

Come and practice Kendo (the way of the sword) at CS Ronin-Do Oradea. This Japanese martial art was ispired by the samurais' fighting and it's practiced safely using a bamboo sword and a specific armour.

servicii în tehnologia informații

We design websites, develop web apps and complete e-commerce solutions. We also develop mobile apps or mobile applications that extend the web apps / the online stores.

web design consultanță software applicații I have been developing apps and sites for a few years, so are in the right place if you are searching for some one in the IT thst can help you. I develop Joomla! extensions, mobile and desktop applications and I offer consultancy about your activities and how they can be more efficient and the implementation or further development of informatic systems that can transform your business into an engine. For more information you can contact me.

I am no longer on on Fiverr because the platform is stupid protecting the clients that do stupid things for money ignoring they depend of us, the web and software developers and some other services, for their own money. I am here so you can call or ask me for a quote. I need to find all the details, estimate the best number of days and ask the best price for all of us. For example, designing a website is about 100 euros, but if you ask for more things yo do I will probably need more time and more money.

Our services - Golden Gravel, the best toolbox for Joomla development

We offer you Joomla extension, components and plugins: JEmbedAll embeds documents, video, and others. Supravirtual extension directory.
  • Debuging your Joomla website and solving the problems

    If your website returns blank screen or if it has errors call me we can fix many of them and we will develop futher your website (especially Joomla and comsidering the development of its extensions). Make the order and we will do the best to solve the issues for your website.

  • Designing your Joomla website

    Developing Joomla websites and their extensions is great, we can do every day and I have been doing this for about a decade or so.

  • Develop your Joomla extensions

    Developing Joomla websites and their extensions is great, we can do it and I have been doing this for about a decade or so.

  • Build and design a responsive Joomla website

    Websites are considered visual brands for any person, entity, product or service. They are a way to show to the entire world (or, at least, to the targeted niche) what someone is doing during this period, what you sell or what you offer now. The first step is establishing the strategy for the following months or years - that's as important as the design and site itself.

Feed not found.