From f0e78ed150799f721cfd76db786fb6e74ee9066a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:11:01 +0000 Subject: [PATCH 1/8] Initial plan From fecd3fe535a82df81cc30396ab5aab7a2855d755 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:16:24 +0000 Subject: [PATCH 2/8] Fix phar path resolution by using Phar::running(false) for WP_CLI_ROOT Replace hardcoded 'phar://wp-cli.phar' with dynamic Phar::running(false) to correctly handle renamed phar files. This ensures WP_CLI_ROOT always points to the actual phar stream path, fixing template path resolution when the phar is not named 'wp-cli.phar'. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- php/boot-phar.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/php/boot-phar.php b/php/boot-phar.php index e5f94a262..de58d26fe 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -12,11 +12,15 @@ // Store the path to the Phar early on for `Utils\phar-safe-path()` function. define( 'WP_CLI_PHAR_PATH', Phar::running( true ) ); -if ( file_exists( 'phar://wp-cli.phar/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', 'phar://wp-cli.phar' ); +// Determine WP_CLI_ROOT dynamically based on the actual phar path +// instead of hardcoding 'phar://wp-cli.phar' to handle renamed phars. +// Use Phar::running(false) to get the phar stream path (e.g., phar:///path/to/file.phar) +// instead of the filesystem path, ensuring consistency when the phar is renamed. +if ( file_exists( Phar::running( false ) . '/php/wp-cli.php' ) ) { + define( 'WP_CLI_ROOT', Phar::running( false ) ); include WP_CLI_ROOT . '/php/wp-cli.php'; -} elseif ( file_exists( 'phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', 'phar://wp-cli.phar/vendor/wp-cli/wp-cli' ); +} elseif ( file_exists( Phar::running( false ) . '/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { + define( 'WP_CLI_ROOT', Phar::running( false ) . '/vendor/wp-cli/wp-cli' ); include WP_CLI_ROOT . '/php/wp-cli.php'; } else { echo "Couldn't find 'php/wp-cli.php'. Was this Phar built correctly?"; From ccdb297c598c2a9698914ecc64c4505d83d350ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:21:16 +0000 Subject: [PATCH 3/8] Correctly use Phar::running() parameters for path resolution Use Phar::running(true) for WP_CLI_ROOT (returns phar:// stream path) and Phar::running(false) for WP_CLI_PHAR_PATH (returns filesystem path). This ensures proper path resolution in phar_safe_path() function. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- php/boot-phar.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/php/boot-phar.php b/php/boot-phar.php index de58d26fe..38f5f8fc0 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -9,18 +9,22 @@ 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 phar stream path for use in determining WP_CLI_ROOT. +// Using Phar::running(true) returns the phar:// stream wrapper path (e.g., phar:///path/to/file.phar) +// which ensures consistent path resolution when the phar is renamed. +$wp_cli_phar_path = Phar::running( true ); -// Determine WP_CLI_ROOT dynamically based on the actual phar path +// Store the filesystem path for `Utils\phar_safe_path()` function. +// Using Phar::running(false) returns just the filesystem path without phar:// protocol. +define( 'WP_CLI_PHAR_PATH', Phar::running( false ) ); + +// Determine WP_CLI_ROOT dynamically based on the actual phar stream path // instead of hardcoding 'phar://wp-cli.phar' to handle renamed phars. -// Use Phar::running(false) to get the phar stream path (e.g., phar:///path/to/file.phar) -// instead of the filesystem path, ensuring consistency when the phar is renamed. -if ( file_exists( Phar::running( false ) . '/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', Phar::running( false ) ); +if ( file_exists( $wp_cli_phar_path . '/php/wp-cli.php' ) ) { + define( 'WP_CLI_ROOT', $wp_cli_phar_path ); include WP_CLI_ROOT . '/php/wp-cli.php'; -} elseif ( file_exists( Phar::running( false ) . '/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', Phar::running( false ) . '/vendor/wp-cli/wp-cli' ); +} elseif ( file_exists( $wp_cli_phar_path . '/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { + define( 'WP_CLI_ROOT', $wp_cli_phar_path . '/vendor/wp-cli/wp-cli' ); include WP_CLI_ROOT . '/php/wp-cli.php'; } else { echo "Couldn't find 'php/wp-cli.php'. Was this Phar built correctly?"; From bf3c0ccc7459ac7d4d17a02a0ebc0f9c8c0b56f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:53:39 +0000 Subject: [PATCH 4/8] Fix phar_safe_path by using Phar::running(false) for WP_CLI_PHAR_PATH Keep WP_CLI_ROOT using the hardcoded alias 'phar://wp-cli.phar' to ensure template paths resolve correctly. Only change WP_CLI_PHAR_PATH to use Phar::running(false) which returns the filesystem path without phar:// protocol, preventing phar_safe_path() from creating malformed paths. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- php/boot-phar.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/php/boot-phar.php b/php/boot-phar.php index 38f5f8fc0..a708cac62 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -9,22 +9,18 @@ die( -1 ); } -// Store the phar stream path for use in determining WP_CLI_ROOT. -// Using Phar::running(true) returns the phar:// stream wrapper path (e.g., phar:///path/to/file.phar) -// which ensures consistent path resolution when the phar is renamed. -$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 ) ); -// Determine WP_CLI_ROOT dynamically based on the actual phar stream path -// instead of hardcoding 'phar://wp-cli.phar' to handle renamed phars. -if ( file_exists( $wp_cli_phar_path . '/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', $wp_cli_phar_path ); +// 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'; -} elseif ( file_exists( $wp_cli_phar_path . '/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { - define( 'WP_CLI_ROOT', $wp_cli_phar_path . '/vendor/wp-cli/wp-cli' ); +} elseif ( file_exists( 'phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { + define( 'WP_CLI_ROOT', 'phar://wp-cli.phar/vendor/wp-cli/wp-cli' ); include WP_CLI_ROOT . '/php/wp-cli.php'; } else { echo "Couldn't find 'php/wp-cli.php'. Was this Phar built correctly?"; From 02593d369e8e4937be1e5c124864ce450bb2e75b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 22:22:42 +0000 Subject: [PATCH 5/8] Add phar_safe_path override to fix template path resolution Created php/utils-override.php with fixed phar_safe_path() that replaces full paths with alias 'phar://wp-cli.phar/' instead of bare 'phar://'. Include this override in boot-phar.php after wp-cli.php is loaded. This is a temporary fix until wp-cli/wp-cli#6242 is merged. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- php/boot-phar.php | 5 ++++- php/utils-override.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 php/utils-override.php diff --git a/php/boot-phar.php b/php/boot-phar.php index a708cac62..b3f7c7bfe 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -11,7 +11,6 @@ // 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 @@ -19,9 +18,13 @@ 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'; + // Override phar_safe_path() to fix template resolution (temporary until wp-cli/wp-cli#6242 is merged) + include __DIR__ . '/utils-override.php'; } elseif ( file_exists( 'phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { define( 'WP_CLI_ROOT', 'phar://wp-cli.phar/vendor/wp-cli/wp-cli' ); include WP_CLI_ROOT . '/php/wp-cli.php'; + // Override phar_safe_path() to fix template resolution (temporary until wp-cli/wp-cli#6242 is merged) + include __DIR__ . '/utils-override.php'; } else { echo "Couldn't find 'php/wp-cli.php'. Was this Phar built correctly?"; exit( 1 ); diff --git a/php/utils-override.php b/php/utils-override.php new file mode 100644 index 000000000..a3c187a9a --- /dev/null +++ b/php/utils-override.php @@ -0,0 +1,33 @@ + Date: Fri, 20 Feb 2026 07:28:02 +0000 Subject: [PATCH 6/8] Use composer patches to fix phar_safe_path in vendor Removed non-working function override approach. Instead, added cweagans/composer-patches plugin and created a patch file to fix phar_safe_path() in wp-cli/wp-cli vendor code. The patch changes the replacement from bare 'phar://' to 'phar://wp-cli.phar/' alias, ensuring template paths resolve correctly. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- composer.json | 11 +++++-- composer.lock | 50 ++++++++++++++++++++++++++++- patches/wp-cli-phar-safe-path.patch | 12 +++++++ php/boot-phar.php | 4 --- php/utils-override.php | 33 ------------------- 5 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 patches/wp-cli-phar-safe-path.patch delete mode 100644 php/utils-override.php diff --git a/composer.json b/composer.json index e60af3c00..bfc9ad05b 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,8 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^5" + "wp-cli/wp-cli-tests": "^5", + "cweagans/composer-patches": "^1.7" }, "suggest": { "psy/psysh": "Enhanced `wp shell` functionality" @@ -50,7 +51,8 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "johnpbloch/wordpress-core-installer": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "cweagans/composer-patches": true }, "autoloader-suffix": "WpCliBundle", "platform": { @@ -62,6 +64,11 @@ "extra": { "branch-alias": { "dev-main": "2.12.x-dev" + }, + "patches": { + "wp-cli/wp-cli": { + "Fix phar_safe_path to use alias path": "patches/wp-cli-phar-safe-path.patch" + } } }, "autoload-dev": { diff --git a/composer.lock b/composer.lock index 0891d4771..e7e82625c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ac842e11c9398e4b41f36175341fcf2", + "content-hash": "461530c16312f6a619b97911c3117c05", "packages": [ { "name": "composer/ca-bundle", @@ -5156,6 +5156,54 @@ "abandoned": true, "time": "2022-03-30T09:27:43+00:00" }, + { + "name": "cweagans/composer-patches", + "version": "1.7.3", + "source": { + "type": "git", + "url": "https://github.com/cweagans/composer-patches.git", + "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", + "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3.0" + }, + "require-dev": { + "composer/composer": "~1.0 || ~2.0", + "phpunit/phpunit": "~4.6" + }, + "type": "composer-plugin", + "extra": { + "class": "cweagans\\Composer\\Patches" + }, + "autoload": { + "psr-4": { + "cweagans\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Cameron Eagans", + "email": "me@cweagans.net" + } + ], + "description": "Provides a way to patch Composer packages.", + "support": { + "issues": "https://github.com/cweagans/composer-patches/issues", + "source": "https://github.com/cweagans/composer-patches/tree/1.7.3" + }, + "time": "2022-12-20T22:53:13+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.2.0", diff --git a/patches/wp-cli-phar-safe-path.patch b/patches/wp-cli-phar-safe-path.patch new file mode 100644 index 000000000..ac6308dc3 --- /dev/null +++ b/patches/wp-cli-phar-safe-path.patch @@ -0,0 +1,12 @@ +--- a/php/utils.php ++++ b/php/utils.php +@@ -1683,7 +1683,7 @@ function phar_safe_path( $path ) { + } + + return str_replace( + PHAR_STREAM_PREFIX . rtrim( WP_CLI_PHAR_PATH, '/' ) . '/', +- PHAR_STREAM_PREFIX, ++ 'phar://wp-cli.phar/', + $path + ); + } diff --git a/php/boot-phar.php b/php/boot-phar.php index b3f7c7bfe..fa8ce85d8 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -18,13 +18,9 @@ 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'; - // Override phar_safe_path() to fix template resolution (temporary until wp-cli/wp-cli#6242 is merged) - include __DIR__ . '/utils-override.php'; } elseif ( file_exists( 'phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php' ) ) { define( 'WP_CLI_ROOT', 'phar://wp-cli.phar/vendor/wp-cli/wp-cli' ); include WP_CLI_ROOT . '/php/wp-cli.php'; - // Override phar_safe_path() to fix template resolution (temporary until wp-cli/wp-cli#6242 is merged) - include __DIR__ . '/utils-override.php'; } else { echo "Couldn't find 'php/wp-cli.php'. Was this Phar built correctly?"; exit( 1 ); diff --git a/php/utils-override.php b/php/utils-override.php deleted file mode 100644 index a3c187a9a..000000000 --- a/php/utils-override.php +++ /dev/null @@ -1,33 +0,0 @@ - Date: Thu, 26 Feb 2026 10:50:28 +0100 Subject: [PATCH 7/8] Undo Copilot changes --- composer.json | 11 +- composer.lock | 150 ++++++++++------------------ patches/wp-cli-phar-safe-path.patch | 12 --- php/boot-phar.php | 7 +- 4 files changed, 55 insertions(+), 125 deletions(-) delete mode 100644 patches/wp-cli-phar-safe-path.patch diff --git a/composer.json b/composer.json index bfc9ad05b..e60af3c00 100644 --- a/composer.json +++ b/composer.json @@ -41,8 +41,7 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^5", - "cweagans/composer-patches": "^1.7" + "wp-cli/wp-cli-tests": "^5" }, "suggest": { "psy/psysh": "Enhanced `wp shell` functionality" @@ -51,8 +50,7 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "johnpbloch/wordpress-core-installer": true, - "phpstan/extension-installer": true, - "cweagans/composer-patches": true + "phpstan/extension-installer": true }, "autoloader-suffix": "WpCliBundle", "platform": { @@ -64,11 +62,6 @@ "extra": { "branch-alias": { "dev-main": "2.12.x-dev" - }, - "patches": { - "wp-cli/wp-cli": { - "Fix phar_safe_path to use alias path": "patches/wp-cli-phar-safe-path.patch" - } } }, "autoload-dev": { diff --git a/composer.lock b/composer.lock index e7e82625c..7602f11d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "461530c16312f6a619b97911c3117c05", + "content-hash": "6ac842e11c9398e4b41f36175341fcf2", "packages": [ { "name": "composer/ca-bundle", @@ -3097,16 +3097,16 @@ }, { "name": "wp-cli/cron-command", - "version": "v2.3.3", + "version": "v2.3.4", "source": { "type": "git", "url": "https://github.com/wp-cli/cron-command.git", - "reference": "c877d87345c2e0f3f7929844d64603bdc116d760" + "reference": "954e5152b5cfedf1222bf45abd8c241b145d429c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/c877d87345c2e0f3f7929844d64603bdc116d760", - "reference": "c877d87345c2e0f3f7929844d64603bdc116d760", + "url": "https://api.github.com/repos/wp-cli/cron-command/zipball/954e5152b5cfedf1222bf45abd8c241b145d429c", + "reference": "954e5152b5cfedf1222bf45abd8c241b145d429c", "shasum": "" }, "require": { @@ -3160,9 +3160,9 @@ "homepage": "https://github.com/wp-cli/cron-command", "support": { "issues": "https://github.com/wp-cli/cron-command/issues", - "source": "https://github.com/wp-cli/cron-command/tree/v2.3.3" + "source": "https://github.com/wp-cli/cron-command/tree/v2.3.4" }, - "time": "2025-11-11T13:30:43+00:00" + "time": "2026-02-13T14:21:27+00:00" }, { "name": "wp-cli/db-command", @@ -3240,20 +3240,20 @@ }, { "name": "wp-cli/embed-command", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/wp-cli/embed-command.git", - "reference": "c95faa486bda28883fd9f0b4702ded2b064061b6" + "reference": "cc10e67d84e0158a96fbc5f48b7652f085cca389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/embed-command/zipball/c95faa486bda28883fd9f0b4702ded2b064061b6", - "reference": "c95faa486bda28883fd9f0b4702ded2b064061b6", + "url": "https://api.github.com/repos/wp-cli/embed-command/zipball/cc10e67d84e0158a96fbc5f48b7652f085cca389", + "reference": "cc10e67d84e0158a96fbc5f48b7652f085cca389", "shasum": "" }, "require": { - "wp-cli/wp-cli": "^2.12" + "wp-cli/wp-cli": "^2.13" }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2", @@ -3301,9 +3301,9 @@ "homepage": "https://github.com/wp-cli/embed-command", "support": { "issues": "https://github.com/wp-cli/embed-command/issues", - "source": "https://github.com/wp-cli/embed-command/tree/v2.1.0" + "source": "https://github.com/wp-cli/embed-command/tree/v2.1.1" }, - "time": "2025-11-11T13:30:46+00:00" + "time": "2026-02-12T12:26:05+00:00" }, { "name": "wp-cli/entity-command", @@ -3602,16 +3602,16 @@ }, { "name": "wp-cli/export-command", - "version": "v2.1.14", + "version": "v2.1.15", "source": { "type": "git", "url": "https://github.com/wp-cli/export-command.git", - "reference": "2af32bf12c1bccd6561a215dbbafc2f272647ee8" + "reference": "84a335ca6e4296aff130659642818473a9b0d90d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/export-command/zipball/2af32bf12c1bccd6561a215dbbafc2f272647ee8", - "reference": "2af32bf12c1bccd6561a215dbbafc2f272647ee8", + "url": "https://api.github.com/repos/wp-cli/export-command/zipball/84a335ca6e4296aff130659642818473a9b0d90d", + "reference": "84a335ca6e4296aff130659642818473a9b0d90d", "shasum": "" }, "require": { @@ -3624,7 +3624,7 @@ "wp-cli/extension-command": "^1.2 || ^2", "wp-cli/import-command": "^1 || ^2", "wp-cli/media-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "type": "wp-cli-package", "extra": { @@ -3659,9 +3659,9 @@ "homepage": "https://github.com/wp-cli/export-command", "support": { "issues": "https://github.com/wp-cli/export-command/issues", - "source": "https://github.com/wp-cli/export-command/tree/v2.1.14" + "source": "https://github.com/wp-cli/export-command/tree/v2.1.15" }, - "time": "2025-04-02T15:29:08+00:00" + "time": "2026-02-12T12:26:09+00:00" }, { "name": "wp-cli/extension-command", @@ -4275,20 +4275,20 @@ }, { "name": "wp-cli/rewrite-command", - "version": "v2.0.16", + "version": "v2.0.17", "source": { "type": "git", "url": "https://github.com/wp-cli/rewrite-command.git", - "reference": "84004ff4d14038d06c6fe489807eb09739e62b94" + "reference": "74c8f12fccce7f2bac04fa363ebcf452494c7afc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/84004ff4d14038d06c6fe489807eb09739e62b94", - "reference": "84004ff4d14038d06c6fe489807eb09739e62b94", + "url": "https://api.github.com/repos/wp-cli/rewrite-command/zipball/74c8f12fccce7f2bac04fa363ebcf452494c7afc", + "reference": "74c8f12fccce7f2bac04fa363ebcf452494c7afc", "shasum": "" }, "require": { - "wp-cli/wp-cli": "^2.12" + "wp-cli/wp-cli": "^2.13" }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2", @@ -4330,9 +4330,9 @@ "homepage": "https://github.com/wp-cli/rewrite-command", "support": { "issues": "https://github.com/wp-cli/rewrite-command/issues", - "source": "https://github.com/wp-cli/rewrite-command/tree/v2.0.16" + "source": "https://github.com/wp-cli/rewrite-command/tree/v2.0.17" }, - "time": "2025-11-11T13:30:58+00:00" + "time": "2026-02-15T11:56:30+00:00" }, { "name": "wp-cli/role-command", @@ -4402,20 +4402,20 @@ }, { "name": "wp-cli/scaffold-command", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/wp-cli/scaffold-command.git", - "reference": "91c93ff2a9f405e2b098e4879e5045372b17f38f" + "reference": "5a690ec1b56ef365ec6c7ec5fef4c6371a0564f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/91c93ff2a9f405e2b098e4879e5045372b17f38f", - "reference": "91c93ff2a9f405e2b098e4879e5045372b17f38f", + "url": "https://api.github.com/repos/wp-cli/scaffold-command/zipball/5a690ec1b56ef365ec6c7ec5fef4c6371a0564f6", + "reference": "5a690ec1b56ef365ec6c7ec5fef4c6371a0564f6", "shasum": "" }, "require": { - "wp-cli/wp-cli": "^2.12" + "wp-cli/wp-cli": "^2.13" }, "require-dev": { "wp-cli/extension-command": "^1.2 || ^2", @@ -4462,9 +4462,9 @@ "homepage": "https://github.com/wp-cli/scaffold-command", "support": { "issues": "https://github.com/wp-cli/scaffold-command/issues", - "source": "https://github.com/wp-cli/scaffold-command/tree/v2.5.2" + "source": "https://github.com/wp-cli/scaffold-command/tree/v2.5.3" }, - "time": "2026-01-09T14:41:03+00:00" + "time": "2026-02-13T09:27:25+00:00" }, { "name": "wp-cli/search-replace-command", @@ -4757,16 +4757,16 @@ }, { "name": "wp-cli/widget-command", - "version": "v2.1.12", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/wp-cli/widget-command.git", - "reference": "73084053f7b32d92583e44d870b81f287beea6a9" + "reference": "6f04d7e0129e0fb280cfc4931bbd40478e743871" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/73084053f7b32d92583e44d870b81f287beea6a9", - "reference": "73084053f7b32d92583e44d870b81f287beea6a9", + "url": "https://api.github.com/repos/wp-cli/widget-command/zipball/6f04d7e0129e0fb280cfc4931bbd40478e743871", + "reference": "6f04d7e0129e0fb280cfc4931bbd40478e743871", "shasum": "" }, "require": { @@ -4774,7 +4774,7 @@ }, "require-dev": { "wp-cli/extension-command": "^1.2 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "type": "wp-cli-package", "extra": { @@ -4818,9 +4818,9 @@ "homepage": "https://github.com/wp-cli/widget-command", "support": { "issues": "https://github.com/wp-cli/widget-command/issues", - "source": "https://github.com/wp-cli/widget-command/tree/v2.1.12" + "source": "https://github.com/wp-cli/widget-command/tree/v2.2.0" }, - "time": "2025-04-11T09:29:37+00:00" + "time": "2026-02-12T12:26:33+00:00" }, { "name": "wp-cli/wp-cli", @@ -4828,12 +4828,12 @@ "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "630e9631e68e2cd622b22197995b832d1e2475fd" + "reference": "ac5cb56bdf6b99509455e0160452c478bc4fc1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/630e9631e68e2cd622b22197995b832d1e2475fd", - "reference": "630e9631e68e2cd622b22197995b832d1e2475fd", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/ac5cb56bdf6b99509455e0160452c478bc4fc1be", + "reference": "ac5cb56bdf6b99509455e0160452c478bc4fc1be", "shasum": "" }, "require": { @@ -4904,7 +4904,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2026-02-13T09:49:39+00:00" + "time": "2026-02-25T23:28:24+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -5156,54 +5156,6 @@ "abandoned": true, "time": "2022-03-30T09:27:43+00:00" }, - { - "name": "cweagans/composer-patches", - "version": "1.7.3", - "source": { - "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3.0" - }, - "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" - }, - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" - }, - "autoload": { - "psr-4": { - "cweagans\\Composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Cameron Eagans", - "email": "me@cweagans.net" - } - ], - "description": "Provides a way to patch Composer packages.", - "support": { - "issues": "https://github.com/cweagans/composer-patches/issues", - "source": "https://github.com/cweagans/composer-patches/tree/1.7.3" - }, - "time": "2022-12-20T22:53:13+00:00" - }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.2.0", @@ -9334,16 +9286,16 @@ }, { "name": "wp-cli/wp-cli-tests", - "version": "v5.0.9", + "version": "v5.0.10", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli-tests.git", - "reference": "aaa3187d96dd7084bd7f3966d25c963abf5ae3a4" + "reference": "26313e2a3d2328519410f46f490756cc60bdaefc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli-tests/zipball/aaa3187d96dd7084bd7f3966d25c963abf5ae3a4", - "reference": "aaa3187d96dd7084bd7f3966d25c963abf5ae3a4", + "url": "https://api.github.com/repos/wp-cli/wp-cli-tests/zipball/26313e2a3d2328519410f46f490756cc60bdaefc", + "reference": "26313e2a3d2328519410f46f490756cc60bdaefc", "shasum": "" }, "require": { @@ -9422,7 +9374,7 @@ "issues": "https://github.com/wp-cli/wp-cli-tests/issues", "source": "https://github.com/wp-cli/wp-cli-tests" }, - "time": "2026-02-05T09:55:02+00:00" + "time": "2026-02-08T15:51:24+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/patches/wp-cli-phar-safe-path.patch b/patches/wp-cli-phar-safe-path.patch deleted file mode 100644 index ac6308dc3..000000000 --- a/patches/wp-cli-phar-safe-path.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/php/utils.php -+++ b/php/utils.php -@@ -1683,7 +1683,7 @@ function phar_safe_path( $path ) { - } - - return str_replace( - PHAR_STREAM_PREFIX . rtrim( WP_CLI_PHAR_PATH, '/' ) . '/', -- PHAR_STREAM_PREFIX, -+ 'phar://wp-cli.phar/', - $path - ); - } diff --git a/php/boot-phar.php b/php/boot-phar.php index fa8ce85d8..e5f94a262 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -9,12 +9,9 @@ die( -1 ); } -// Store the filesystem path for `Utils\phar_safe_path()` function. -// Using Phar::running(false) returns just the filesystem path without phar:// protocol. -define( 'WP_CLI_PHAR_PATH', Phar::running( false ) ); +// Store the path to the Phar early on for `Utils\phar-safe-path()` function. +define( 'WP_CLI_PHAR_PATH', Phar::running( true ) ); -// 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'; From d7ca713aea8103b9cd3761c7ca4b3ff8ff3eaf29 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 26 Feb 2026 10:50:59 +0100 Subject: [PATCH 8/8] Add back fix without patch, add tests --- features/bootstrap.feature | 14 ++++++++++++++ php/boot-phar.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/features/bootstrap.feature b/features/bootstrap.feature index b2ef01e7a..8024e37b4 100644 --- a/features/bootstrap.feature +++ b/features/bootstrap.feature @@ -81,3 +81,17 @@ Feature: Bootstrap WP-CLI Status: Inactive """ And STDERR should be empty + + Scenario: Mustache templates should be resolved correctly when PHAR is renamed without extension + + Given an empty directory + And a new Phar with the same version + And I run `php {PHAR_PATH} core download` + + When I run `cp {PHAR_PATH} wp-renamed` + And I run `php wp-renamed config create --dbname=wordpress --dbuser=user --dbpass=pass --skip-check` + Then STDOUT should contain: + """ + Success: Generated 'wp-config.php' file. + """ + And STDERR should be empty diff --git a/php/boot-phar.php b/php/boot-phar.php index e5f94a262..64fb7e948 100644 --- a/php/boot-phar.php +++ b/php/boot-phar.php @@ -10,7 +10,7 @@ } // Store the path to the Phar early on for `Utils\phar-safe-path()` function. -define( 'WP_CLI_PHAR_PATH', Phar::running( true ) ); +define( 'WP_CLI_PHAR_PATH', Phar::running( false ) ); if ( file_exists( 'phar://wp-cli.phar/php/wp-cli.php' ) ) { define( 'WP_CLI_ROOT', 'phar://wp-cli.phar' );