-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[5.3] Fix undefined array key "language" in sef plugin #45959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.3-dev
Are you sure you want to change the base?
[5.3] Fix undefined array key "language" in sef plugin #45959
Conversation
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 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45959. |
Thank you for explaining how to properly confirm my test for this issue. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45959. |
@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 was not able to replicate the problem... checked the PHP.ini file to ensure I would get the warning but to no avail... Emmanuel @exlemor as well |
I have tested this item 🔴 unsuccessfully on 179b4df 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. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45959. |
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 Steps to reproduce:
Current behavior: 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. Expected behavior: Additional information: ![]() 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: Could this be the right solution? |
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. |
Pull Request for Issue #45820 .
Summary of Changes
This pull request (PR) fixes the
undefined array key "language"
error in the SEF plugin on multilingual sites.Testing Instructions
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.
Actual result BEFORE applying this Pull Request
PHP Warning: Undefined array key "language" in /plugins/system/sef/src/Extension/Sef.php on line 122.
Expected result AFTER applying this Pull Request
Not such PHP warning.
Link to documentations
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