fix: remove preceding and trailing whitespace from config
Description
Create recursive function to remove white space during the writing of the config/config.php file. This will remove white space from nested array values as well (hence the recursive function).
Related Issue
- Fixes #33294
Motivation and Context
Solves issues with the SMTP server input where if there were white spaces preceding or succeeding the input the connection would error out. Creates a better user experience for the user as sometimes you may not see that you entered a white space either before or after an input.
How Has This Been Tested?
test environment:
- OS: Ubuntu 22.04 LTS
- Database: PostgreSQL 14
- Web Server: Apache2
Testing Procedure
- Modified PHPUnit
testSetValue()test to add white space and the beginning and end of a value and then make sure that the output does not include white space.
Screenshots (if appropriate):
SMTP server address with preceding and succeeding spaces.
Saved value in
config/config.php that has preceding and succeeding white spaces removed.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Database schema changes (next release will require increase of minor version instead of patch)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Technical debt
- [ ] Tests only (no source changes)
Checklist:
- [x] Code changes
- [x] Unit tests added
- [x] Acceptance tests added
- [ ] Documentation ticket raised:
- [ ] Changelog item, see TEMPLATE
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.
Having trouble getting the tests to run. I have tried to go back and run tests on my machine before I added changes but they still don't all finish properly. Any advice on how to get OC unit tests setup properly on a Ubuntu 22.04 LTS system?