-
Notifications
You must be signed in to change notification settings - Fork 67
Filter empty database parameters to prevent MySQL command failures #308
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
/gemini review |
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.
Code Review
This pull request aims to prevent MySQL command failures by filtering out empty database parameters. The approach is sound, but the current implementation has a flaw: it filters parameters from wp-config.php before merging them with command-line arguments. This means the fix can be bypassed if an empty value is provided as a command-line argument. I've suggested applying the filter after all arguments are merged to create a more robust solution.
Additionally, the new test case for an empty DB_CHARSET doesn't actually exercise the new filtering logic due to a pre-existing condition. I've recommended an alternative test scenario that would better validate the changes.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Fix Plan: mysqlcheck empty character set error
run()function to identify where empty values are addedrun()function to skip empty string and null values$final_argsafter merge to catch empty CLI argsDB_HOSTinstead ofDB_CHARSETSummary
Successfully fixed the issue where database commands fail when DB constants are empty strings. The fix:
$final_argsafter merging to catch empty values from both wp-config and CLI argsDB_HOSThandling and verifies successful executionOriginal prompt
This section details on the original issue you should resolve
<issue_title>mysqlcheck: Character set '' is not a compiled character set</issue_title>
<issue_description>## Bug Report
When running commands related to
dbat hostinger, I get the following error.Hostinger support said it's a bug with the wp-cli, and my debug shows the same..
Describe the current, buggy behavior
When running
wp db checkin any of my wp installs at hostinger, I get the following:With debug...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.