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

"Site temporary unavailable" an error occurs during installation with a certain character in the password #16261

Closed
obelov opened this issue Sep 13, 2022 · 2 comments · Fixed by #16264
Labels
bug The issue in the code or project, which should be addressed.

Comments

@obelov
Copy link

obelov commented Sep 13, 2022

Bug report

Summary

About MySQL passwords, contains "\" symbol and incorrect character processing "\"

Step to reproduce

during the installation step in the "MySQL user password" field, enter the password containing the character "\"

Observed behavior

After clicking the "install" button, an error is thrown "Site temporary unavailable"
In the config file "/core/config/config.inc.php" MySQL password contains an extra character "\\"

Expected behavior

a message should appear : "Core installation was successful. Click next to complete the installation process."

Environment

MODX version 3.0.1 Advanced, Apache, MySQL 10.5.16-MariaDB, Firefox 104.0.2

@obelov obelov added the bug The issue in the code or project, which should be addressed. label Sep 13, 2022
@halftrainedharry
Copy link
Contributor

The problem seems to be this line in the code:

/**
* Sanitize MySQL Password before writing to config, escaping '
* I'm sure there's a better way to do this, but this works for now.
* Otherwise, we risk fatal PHP errors if the entered Password
* contains any single quotes as they would escape the string.
* See GitHub issue 12502 for more information. https://github.com/modxcms/revolution/issues/12502
*/
$this->install->settings->settings['database_password'] = addslashes($this->install->settings->settings['database_password']);

I don't think the problem is the double backslash in the config file \\ (as the backslash is an escape character).
I think the problem is that the settings is changed here (to write it correctly to the config file), but this (changed) setting is then later used again in the installation script.

@JoshuaLuckers
Copy link
Contributor

Are you sure the error is related to the password? Is there anything in the MODX and/or PHP error log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
3 participants