Skip to content
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

[4.3.4] Undefined array key "en-GB" and Attempt to read property "sef" \plugins\system\languagefilter\languagefilter.php on line 226 #41798

Closed
peterhulst opened this issue Sep 18, 2023 · 9 comments

Comments

@peterhulst
Copy link

peterhulst commented Sep 18, 2023

Steps to reproduce the issue

  • Have all content languages unpublished
  • Enable the plugin language filter with default settings
  • Site language en-GB

Expected result

Correct display website display

Actual result

A lot of warnings:
Warning: Undefined array key "en-GB" in ...\plugins\system\languagefilter\languagefilter.php on line 226
Warning: Attempt to read property "sef" on null in ...\plugins\system\languagefilter\languagefilter.php on line 226

System information (as much as possible)

Joomla 4.3.4
PHP 8.0.28, PHP 8.1.23

Additional comments

When disable the plugin language filter the warnings disappear.

@peterhulst peterhulst changed the title Undefined array key "en-GB" and Attempt to read property "sef" \plugins\system\languagefilter\languagefilter.php on line 226 [4.3.4] Undefined array key "en-GB" and Attempt to read property "sef" \plugins\system\languagefilter\languagefilter.php on line 226 Sep 18, 2023
@richard67
Copy link
Member

richard67 commented Sep 19, 2023

Can it be that the content language for en-GB is missing? I don’t mean the language packs or extensions, I mean the content languages, that’s an extra point in the manage area of the system panel. That’s where the sef property should come from which is mentioned in the error message.

@peterhulst
Copy link
Author

peterhulst commented Sep 20, 2023

Hello Richard, you are right: the en-GB was unpublished. After publishing it, the error disappeared.
Is it an idea that a hint is displayed instead many error messages in case this happens?
Thanks for your help.
Regards

@richard67
Copy link
Member

Is it an idea that a hint is displayed instead many error messages in case this happens? Thanks for your help. Regards

@peterhulst Well, I would indeed expect a useful alert instead of an uncaught exception when you enable the language filter and the content language is not published.

I think that's a bug.

On a multilingual site there is also a module shown in the administrator (in the default Atum template it's shown at the top) called "Multilingual Status" or so. That opens a modal which shows what's missing on a multilingual site, and it should show that the content language is not published.

@richard67 richard67 added the bug label Sep 20, 2023
@richard67
Copy link
Member

I've added a sentence about the unpublished content languages to the description (initial post) of this issue so quick readers can better see what the issue is.

@peterhulst
Copy link
Author

Thank you for the comment.

@brianteeman
Copy link
Contributor

When you unpublish all the content languages you already get a nice error message

image

@peterhulst
Copy link
Author

Thank you Brian!
Indeed this message is very clear.
Regards,
Peter

@richard67
Copy link
Member

Well that's the nice error message when you unpublish the site languages. But when you have them unpublished and enable the language filter, we have the PHP warnings.

So should we leave this issue open and hope someone fixes that, too? Or shall we close it as expected behaviour?

@Hackwar
Copy link
Member

Hackwar commented Apr 8, 2024

I created a PR. Please test #43232. Since we have a PR, I'm closing this issue.

@Hackwar Hackwar closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants