-
Notifications
You must be signed in to change notification settings - Fork 989
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
Fix template path for Phar installs #5918
base: main
Are you sure you want to change the base?
Conversation
@@ -602,7 +602,7 @@ function run_mysql_command( $cmd, $assoc_args, $_ = null, $send_to_shell = true, | |||
*/ | |||
function mustache_render( $template_name, $data = [] ) { | |||
if ( ! file_exists( $template_name ) ) { | |||
$template_name = WP_CLI_ROOT . "/templates/$template_name"; | |||
$template_name = phar_safe_path( WP_CLI_ROOT . "/templates/$template_name" ); |
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.
Should we add a test for this? Also, can we document the nature of the change in the PR description?
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.
@danielbachhuber PR description updated. I don't know how to write test for this change.
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.
@wojsmol Were you able to reproduce the original issue and confirm that this fixes it?
I'm a little unclear that this is the actual solution. In reviewing #4689 (comment), wp config create
is already passing a Phar-safe path:
As such, the file_exists()
check should return true and this particular block of code shouldn't be executed.
Related #4689
Fixes paths used for accessing the Mustache template files within the Phar file will need to be wrapped in
Utils\phar_safe_path()
.