Skip to content
Draft
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
8 changes: 6 additions & 2 deletions php/boot-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
die( -1 );
}

// Store the path to the Phar early on for `Utils\phar-safe-path()` function.
define( 'WP_CLI_PHAR_PATH', Phar::running( true ) );
// Store the filesystem path for `Utils\phar_safe_path()` function.
// Using Phar::running(false) returns just the filesystem path without phar:// protocol.
// This prevents phar_safe_path() from attempting to replace "phar://phar://..." incorrectly.
define( 'WP_CLI_PHAR_PATH', Phar::running( false ) );

// Use the phar alias 'wp-cli.phar' which is set during phar creation and works
// regardless of the actual filename. This ensures template paths resolve correctly.
if ( file_exists( 'phar://wp-cli.phar/php/wp-cli.php' ) ) {
define( 'WP_CLI_ROOT', 'phar://wp-cli.phar' );
include WP_CLI_ROOT . '/php/wp-cli.php';
Expand Down
Loading