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

[3.0] Installer needs General language file? #8221

Closed
DiegoAndresCortes opened this issue May 11, 2024 · 17 comments · Fixed by #8223
Closed

[3.0] Installer needs General language file? #8221

DiegoAndresCortes opened this issue May 11, 2024 · 17 comments · Fixed by #8223
Labels
Installer Localization Language & internationalization
Milestone

Comments

@DiegoAndresCortes
Copy link
Contributor

The installer uses formatMessage for $txt['install_welcome_desc'] but this method will fail when it attempts to get $txt['lang_locale'] because the general language file is not loaded in the installer.

@Sesquipedalian
Copy link
Member

Well, that's an easy thing to fix.

@DiegoAndresCortes
Copy link
Contributor Author

After fixing it, my installer times out in step 2

@DiegoAndresCortes
Copy link
Contributor Author

Without your pull request I get the following (and the db is created):

Uncaught Error: Typed static property SMF\User::$me must not be accessed before initialization in \Sources\Db\APIs\MySQL.php:258 Stack trace: #0 \install.php(1495): SMF\Db\APIs\MySQL->query('', 'SELECT id_event...', Array) #1 \install.php(179): DatabasePopulation() #2 {main} thrown in \Sources\Db\APIs\MySQL.php on line 258

@Sesquipedalian
Copy link
Member

Without your pull request I get the following (and the db is created):

Uncaught Error: Typed static property SMF\User::$me must not be accessed before initialization in \Sources\Db\APIs\MySQL.php:258 Stack trace: #0 \install.php(1495): SMF\Db\APIs\MySQL->query('', 'SELECT id_event...', Array) #1 \install.php(179): DatabasePopulation() #2 {main} thrown in \Sources\Db\APIs\MySQL.php on line 258

Yes, that is one of the errors fixed by the PR.

@DiegoAndresCortes
Copy link
Contributor Author

Yup, times out with the PR on step 2. I don’t have errors or warnings.

@Sesquipedalian
Copy link
Member

Odd. I can't test at the moment, but could you try reverting the change to the user agent constant (the only other change in install.php) and then test again?

@DiegoAndresCortes
Copy link
Contributor Author

Reverted the line, no more time out but two issues:

Warning: Undefined array key "theme_guests" in \Sources\Theme.php on line 203

Uncaught Error: Typed static property SMF\User::$me must not be accessed before initialization in \Theme.php:207 Stack trace: #0 \Sources\ErrorHandler.php(598): SMF\Theme::load() #1 \Sources\ErrorHandler.php(296): SMF\ErrorHandler::setupFatalContext('Please try agai...') #2 \Sources\Db\APIs\MySQL.php(267): SMF\ErrorHandler::fatal('Please try agai...', false) #3 \install.php(1495): SMF\Db\APIs\MySQL->query('', 'SELECT id_event...', Array) #4 \install.php(179): DatabasePopulation() #5 {main} thrown in \Sources\Theme.php on line 207

@Sesquipedalian
Copy link
Member

Latest commits to #8204 should fix those.

@DiegoAndresCortes
Copy link
Contributor Author

Got a few more

Warning: Undefined array key "default_timezone" in \Sources\User.php on line 5126

Warning: Undefined array key "BAN_CHECK_IP" in \Sources\User.php on line 4682

Warning: Undefined array key "time_format" in \Sources\User.php on line 4700

Fatal error: Uncaught TypeError: Cannot assign null to property SMF\User::$time_format of type string in \Sources\User.php:4700 Stack trace: #0 \Sources\User.php(4594): SMF\User->setProperties() #1 \Sources\User.php(2558): SMF\User->__construct(NULL, NULL) #2 \Sources\Theme.php(2372): SMF\User::load() #3 \Sources\Theme.php(260): SMF\Theme->initialize() #4 \Sources\ErrorHandler.php(598): SMF\Theme::load() #5 \Sources\ErrorHandler.php(296): SMF\ErrorHandler::setupFatalContext('Please try agai...') #6 \Sources\Db\APIs\MySQL.php(267): SMF\ErrorHandler::fatal('Please try agai...', false) #7 \install.php(1495): SMF\Db\APIs\MySQL->query('', 'SELECT id_event...', Array) #8 \install.php(179): DatabasePopulation() #9 {main} thrown in \Sources\User.php on line 4700

@Sesquipedalian
Copy link
Member

I've added another commit to #8204 to fix those, too.

@DiegoAndresCortes
Copy link
Contributor Author

Another round

Warning: Undefined array key "avatar_url" in \Sources\User.php on line 2860

Warning: Undefined array key "smiley_sets_known" in \Sources\Theme.php on line 2607

Fatal error: Uncaught TypeError: explode(): Argument #2 ($string) must be of type string, null given in \Sources\Theme.php:2607 Stack trace: #0 \Sources\Theme.php(2607): explode(',', NULL) #1 \Sources\Theme.php(2375): SMF\Theme->fixSmileySet() #2 \Sources\Theme.php(260): SMF\Theme->initialize() #3 \Sources\ErrorHandler.php(598): SMF\Theme::load() #4 \Sources\ErrorHandler.php(296): SMF\ErrorHandler::setupFatalContext('Please try agai...') #5 \Sources\Db\APIs\MySQL.php(267): SMF\ErrorHandler::fatal('Please try agai...', false) #6 \install.php(1495): SMF\Db\APIs\MySQL->query('', 'SELECT id_event...', Array) #7 \install.php(179): DatabasePopulation() #8 {main} thrown in \Sources\Theme.php on line 2607

@Sesquipedalian
Copy link
Member

I've amended the commit to fix those as well

@DiegoAndresCortes
Copy link
Contributor Author

I'm afraid they keep coming. Might need to set all of the $modSettings keys to a default value instead?

@DiegoAndresCortes
Copy link
Contributor Author

The one that errored out (no warning), was this one:
Utils::$context['news_lines'] = array_filter(explode("\n", str_replace("\r", '', trim(addslashes(Config::$modSettings['news'])))));
But still had various warnings from others.

@Sesquipedalian
Copy link
Member

Alright, I've backed up and taken another approach. The initial error that you are encountering on line 1495 of install.php will still happen, but now it will simply die rather than trying to load all the usual stuff needed to display a fatal error message in a theme template.

Solving that initial error can be the subject of a separate PR.

@Sesquipedalian
Copy link
Member

Sesquipedalian commented May 13, 2024

Actually, I've decided to move the fixes for this installer issue into their own PR (#8223) rather than tacking them onto the fixes for the upgrader. Please test that PR to see if it solves the issue for you, @DiegoAndresCortes.

You will most likely still run into the issue on line 1495 of install.php, but we'll need to deal with that once it can be isolated from the cascade of other problems that followed it.

@DiegoAndresCortes
Copy link
Contributor Author

I’ll test later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Installer Localization Language & internationalization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants