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

White page of death when switching language in the user setting page #1263

Closed
ablears opened this issue Sep 12, 2024 · 6 comments
Closed

White page of death when switching language in the user setting page #1263

ablears opened this issue Sep 12, 2024 · 6 comments
Labels
confirmed bug Something isn't working
Milestone

Comments

@ablears
Copy link

ablears commented Sep 12, 2024

Affected sprinkle or package

userfrosting/UserFrosting

UserFrosting or package Version

5.1.3

Debug Data

UserFrosting Environnement Information
======================================

 -------------------- --------------------------------------------------------
  Framework version    5.1.3
  OS Name              Linux
  Main Sprinkle        My Application
  Main Sprinkle Path   /var/www/portal-staging.internationalbarcodes.net/app/
  Environment mode     default
  PHP Version          8.3.10
  Node Version         v20.11.1
  NPM Version          10.5.0
 -------------------- --------------------------------------------------------


Loaded Sprinkles
================

 ------------------ --------------------------------------- ----------------------------------------------------------------------------------------------------
  Sprinkle           Namespace                               Path
 ------------------ --------------------------------------- ----------------------------------------------------------------------------------------------------
  Core Sprinkle      UserFrosting\Sprinkle\Core\Core         /var/www/portal-staging.internationalbarcodes.net/vendor/userfrosting/sprinkle-core/app/src/../
  Account Sprinkle   UserFrosting\Sprinkle\Account\Account   /var/www/portal-staging.internationalbarcodes.net/vendor/userfrosting/sprinkle-account/app/src/../
  AdminLTE Theme     UserFrosting\Theme\AdminLTE\AdminLTE    /var/www/portal-staging.internationalbarcodes.net/vendor/userfrosting/theme-adminlte/app/src/../
  Admin Sprinkle     UserFrosting\Sprinkle\Admin\Admin       /var/www/portal-staging.internationalbarcodes.net/vendor/userfrosting/sprinkle-admin/app/src/../
  My Application     UserFrosting\App\MyApp                  /var/www/portal-staging.internationalbarcodes.net/app/src/../
 ------------------ --------------------------------------- ----------------------------------------------------------------------------------------------------


Database config
===============

 ------------ ------------
  CONNECTION   mysql
 ------------ ------------
  DRIVER       mysql
  HOST         localhost
  PORT         3306
  DATABASE     portal
  USERNAME     *********
  PASSWORD     *********
 ------------ ------------


Testing database connection...
==============================


 [OK] Database connection successful

Chat Discussion (optional)

No response

Description

The site only shows in English.

Running php bakery locale:dictionary and selecting a language, eg pt_BR, brings back the full dictionary OK.

My sprinkle has the language files at /app/locale/pt_BR/*. Running cat messages.php shows my translations.

/app/config/default.php includes site.locales.available which contains pt_BR' => true

The HTML head tag contains the language code <html lang="pt_BR" style="height: auto; min-height: 100%;">

The only clue is the output of php bakery locale:compare -l en_US -r pt_BR which shows

=================
Comparing `en_US` with `pt_BR`
------------------------------
Comparison between Brazilian portuguese and English
---------------------------------------------------
In` ByteString.php line 444:
  Invalid "UTF-8" string.

Translations worked in 4 and 5, but not after upgrading to 5.1

So I added error logging just before the error message to identify the string: string(59) "�lido. Escolha um nome diferente, ou clique em 'sugestão'."

Searching for that string:
ack 'Escolha um nome diferente' . app/sprinkles/sprinkle-account/app/locale/pt_BR/messages.php 144: 'NOT_AVAILABLE' => 'Usuário <strong>{{user_name}}</strong> não é válido. Escolha um nome diferente, ou clique em \'sugestão\'.',

So the error is coming from v**á**lido in the string above.

Running a similar comparison using a different language also results in errors, eg php bakery locale:compare -l en_US -r fr_FR shows an error for string(20) "� la page d'accueil."

I'm not sure if the ByteString error is the reason translations are not showing, but at least it's something to work off.

Logging in and changing my user profile language at /account/settings/profile to a non-English language results in a white screen with no errors in either the PHP or userfrosting log files.

Steps To Reproduce

No response

@lcharette lcharette added the confirmed bug Something isn't working label Sep 13, 2024
@lcharette lcharette added this to the 5.1.x milestone Sep 13, 2024
@lcharette
Copy link
Member

I've been able to replicate the Invalid "UTF-8" string error in the bakery command, however the website works correctly when using the built in PHP server.

The white page you're seeing might not be related. Does it appear on every page? Have you checked the browser console for any error? Otherwise, can you double check the logs to get any clues ?

@ablears
Copy link
Author

ablears commented Sep 13, 2024

Hi, the white page appears on the /account/settings/profile route if I change my language and save the change.
No PHP, userfrosting or console log errors. The env is set to debug.

https://somup.com/cZQIVtmyEL shows the issues.

To confirm:

  1. A fresh install exhibits the bakery command error.
  2. For non-logged in users, the pages are always in English regardless of the html lang attribute
  3. Logging in and setting a language at /account/settings/profile causes the white screen but the language does update. Viewing the pages then does show in the correct language.

@lcharette
Copy link
Member

So looks like three issues... I wasn't able to replicate the white page again. Did you get the same error in a fresh install? Any custom code to the account/setting pages?

@lcharette lcharette changed the title Language localisation is not working, only English shows White page of death when switching language in the user setting page Sep 15, 2024
@lcharette
Copy link
Member

I've split the issue in 3 since there's really 3 problem here. Let focus on the white page of death here. The other two issues I can replicate and should be able to fix relatively soon.

@ablears
Copy link
Author

ablears commented Sep 16, 2024

Hi, thanks for your help so far.

I did a code comparison between my template at /app/templates/pages/account-settings.html.twig and the one supplied in vendor/userfrosting/theme-adminlte/app/templates/pages/account-settings.html.twig. There were no differences, however deleting /app/templates/pages/account-settings.html.twig fixed the issue.

What I did notice is that when the error triggered (with my template in place), the URL would change to /account/settings/profile.

I've not zeroed in on the exact cause, but it appears to be related to my setup and I don't need to make changes to account-settings.html.twig, so I think we can close this one.

@lcharette
Copy link
Member

lcharette commented Sep 17, 2024

Alright. Let me know if this needs to be reopened.

@lcharette lcharette closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in UserFrosting Task Planner Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants