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
During installation, trim inputs in the database setup page to avoid whitespaces issues #12502
Conversation
'password' => $this->getSubmitValue('password'), | ||
'host' => trim($this->getSubmitValue('host')), | ||
'username' => trim($this->getSubmitValue('username')), | ||
'password' => trim($this->getSubmitValue('password')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A password may end or start with a whitespace maybe? possibly the same for username (although not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure you cannot use whitespaces in MySQL/MariaDB username and password. If anyone can provide source otherwise, you are welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tested it and worked with a whitespace at the end of the password. For username didn't work but not sure if there is a way to make it work...
CREATE USER 'newuser2'@'%' IDENTIFIED BY 'password ';
GRANT ALL PRIVILEGES ON * . * TO 'newuser2'@'%';
FLUSH PRIVILEGES;
there could be whitespaces at the borders in some niche scenario
Awesome looks great and will be so useful making install easier 👍 I just noticed one more thing. |
I'm not at work till monday, but you can push that yourself. I think it would be easiest to save the value in an variable and than use shorthand if to return the variable or null. |
Should be done :) |
Awesome, does it need to be done for DB Name as well? Just to avoid maybe a possible notice or so? In theory might not be needed to have a check there because we check for |
Are you sure it throws a notice? Did not found any information about that? |
Only HHVM seems to trigger a notice in some versions: https://3v4l.org/71CT5 |
Thanks for the PR @fdellwing! 👍 |
* Update FormDatabaseSetup.php * undo trim of user and password there could be whitespaces at the borders in some niche scenario * respect input could be null
Fixes #12499