-
Notifications
You must be signed in to change notification settings - Fork 67
Only unset defaults before running command. #279
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?
Only unset defaults before running command. #279
Conversation
… in querying the SQL mode
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/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 refactors the handling of the --defaults flag by centralizing its unsetting to the run method. This ensures that the flag is correctly processed by get_defaults_flag_string to determine whether --no-defaults should be added to the command, and then removed before being passed to the underlying MySQL command execution. This improves the maintainability and correctness of argument handling, especially for commands that query SQL modes, as the defaults flag is now available for evaluation until the final command execution step. The changes are well-implemented and align with the stated objective.
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.
Pull request overview
This PR fixes a bug where database queries fail when using TLS/SSL connections with non-standard certificate authorities. The issue occurred because the --defaults flag was being removed too early in the execution flow, preventing MySQL client configuration files (which may contain TLS settings) from being loaded when querying SQL modes.
Changes:
- Move the removal of the
defaultskey fromget_defaults_flag_string()to therun()method, allowing MySQL defaults files to be used when querying SQL modes while still preventing the invalid argument from being passed to MySQL
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( true === Utils\get_flag_value( $assoc_args, 'defaults' ) ) { | ||
| $flag_string = ''; | ||
| } | ||
|
|
||
| unset( $assoc_args['defaults'] ); | ||
|
|
||
| } |
Copilot
AI
Jan 20, 2026
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.
Since get_defaults_flag_string() no longer removes the 'defaults' key from the array, consider updating the method signature from protected function get_defaults_flag_string( &$assoc_args ) to protected function get_defaults_flag_string( $assoc_args ) to remove the unnecessary by-reference parameter.
Allow defaults to be used in querying the SQL mode
Fixes #278