silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 820 forks source link

Fix #11289: Handle paths with spaces in Silverstripe's sake script #11290

Closed digitall-it closed 5 days ago

digitall-it commented 6 days ago

Description

Expected Behaviour: vendor/bin/sake should function correctly regardless of where the PHP binary is located, even if the path includes spaces.

Observed Behaviour: If the path to the PHP interpreter contains spaces, the script fails with an error because the path isn’t wrapped in quotes, leading to incorrect parsing of the command.

This fix ensures that all paths in the sake script are properly quoted to handle spaces and other special characters that might appear in directory names.

Manual Testing Steps

  1. Place your PHP binary in a path with spaces and set up the environment variable or path accordingly.
  2. Run vendor/bin/sake build to ensure it picks up the PHP binary and executes without errors.
  3. Check other commands and scenarios where sake is used to ensure no other side effects are introduced by this change.

Issues

Pull Request Checklist

Additional Notes

Please review the changes and provide feedback or merge if everything is in order.

Thank you!

digitall-it commented 6 days ago

I suggest revisiting the script to ensure that the use of the new syntax "${@}" instead of the old ${*} does not introduce unintended side effects.

The ${@} syntax, when quoted, ensures each argument is preserved in its entirety, which is crucial for handling paths or options that include spaces. It's important to verify that this change maintains the desired behavior throughout the script.