Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion php/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1465,11 +1465,24 @@ function phar_safe_path( $path ) {
return $path;
}

return str_replace(
$path = str_replace(
PHAR_STREAM_PREFIX . rtrim( WP_CLI_PHAR_PATH, '/' ) . '/',
PHAR_STREAM_PREFIX,
$path
);

if (
defined( 'WP_CLI_PHAR_HOST_FILENAME' ) &&
WP_CLI_PHAR_HOST_FILENAME &&
WP_CLI_PHAR_HOST_FILENAME !== 'wp-cli.phar'
) {
$parts = explode( '/' . WP_CLI_PHAR_HOST_FILENAME . '/', $path, 2 );
if ( count( $parts ) === 2 ) {
$path = $parts[0] . '/wp-cli.phar/' . $parts[1];
}
}

return $path;
}

/**
Expand Down