User tests: Successful: Unsuccessful:
Pull Request for Issue #45820 .
This pull request (PR) fixes the undefined array key "language"
error in the SEF plugin on multilingual sites.
See issue #45820 :
Set up a multilingual site with SEF URLs enabled.
Enable the SEF plugin with its default settings.
Visit the site (frontend) and check your PHP error log.
PHP Warning: Undefined array key "language" in /plugins/system/sef/src/Extension/Sef.php on line 122.
Not such PHP warning.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
Tested JL 5.3.3. It works.
@mckillo Could you mark your test result in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/45959 by using the blue "Test this" button at the top left corner, selecting your test result and submit, so your test is properly counted?
Each PR needs 1 successful human tests to get accepted, and for this we have that counter and the issue tracker with that button.
Thanks in advance.
I have tested this item ✅ successfully on 179b4df
Thank you for explaining how to properly confirm my test for this issue.
Thank you for explaining how to properly confirm my test for this issue.
@mckillo Welcome. If you would like to practice that further: On Saturday we will have a PBF (Pizza, Bugs & Fun) event were people meet virtually or physically to test PRs or fix issues by creating PR or helping with documentation.
As we (Joomla) celebrate our 20th birthday we hope to see many people joining it. Would be nice to have you, too.
You can find more info and the necessary links here: https://www.pizza-bugs-fun.com/en/
I have tested this item 🔴 unsuccessfully on 179b4df
I have tested this unsuccessfully sadly @richard67.
Under PHP 8.1, 8.2, 8.3 or 8.4 - with PHP error_reporting=E_ALL and log_errors=On and can not get the error message to show up WITHOUT the PR applied. Olivier and I both were doing it at the same time, me on my hosting and him on his local environment BearsAmp, PHP 8.3 and he also couldn't get this error message to show BEFORE the patch applied.
I have tried to investigate this problem in the site.
This are the data in the breakpoint of this line when the issue occurs, the variable $parsedVars['language'] does not exist.
Environment: Joomla 5.3.3, PHP 8.3.24, MariaDB 10.6.10
Site with multiple languages: ES, EN, FR, GE, IT
Steps to reproduce:
Current behavior:
The following warning message is displayed:
This happens because the link is wrong. The user (customer) changed the end article alias, but the link of button is the old.
Joomla tries to load the article with alias 787-precios-2023-24 (link button), which no longer exists.
Since the article with ID 787 is still valid, Joomla shows the warning for about one second and then automatically redirects to the correct URL: https://domain.com/web/tablon-de-informacion/787-precios-2024-25
Expected behavior:
Joomla should directly resolve the article by its ID and redirect to the updated alias, without showing the warning.
Additional information:
The article has multilingual associations with other languages:
I hope this information helps to reproduce the issue.
The button link is the URL for the default language of the website.
The issue is not related to $parsedVars['language'], because before route.php runs there is no 'language' key in $vars. Also, the 'language' parameter does not exist in abstractUri.php either.
A possible solution for sites with multiple languages:
Perform the routing by ID instead, and do not show the warning.
$parsedVars['language'] should be initialized with the default site language if it is not defined in the link URL.
That way it would always exist, and the patch 179b4dff1a96659dbc3c15e4eb52c3840b33fc9d would not be necessary, because this provides a better fix for the root of the problem (origin).
Could this be the right solution?
I have tried to investigate this problem in the site.
Hi @mckillo - I really appreciate that you went through all of this trouble to explain, and try to find a solution - sadly, I just went through it again and still can't get it to show the error ;( on my test site with 2 languages - wonder if it you need more than 2 languages for this to appear -
Either way, I really appreciate it!
@Hackwar Could you check the 2 previous comments by @mckillo , #45959 (comment) and #45959 (comment) ? I'm not sure if the expected behaviour is right as I'm not deep enough into the router.
More info about the case
This website runs on Joomla 5.3.3 (migrated from previous Joomla). The article URL contains the article ID (article - options - integration - used Id in the alias). The article is set only for the default language.
The first error is in the button link: it still points to the old link of the article. The current link uses a different alias, but the article ID is the same.
All SEF plugin settings are unused, and the issue originates earlier. The URL of the button (the old link with the article ID) is detected as isTainted and enters the if condition (line 118). The router detects an error in the URL: the alias part is incorrect while the ID is correct, since the article ID belongs to an active (published) article. Because of this, the router marks the URL as isTainted and tries to build a new URL for the article.
Tested JL 5.3.3. It works.