From f00f5443f785fe7258ce730785978f39f568e7d8 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 21 Jul 2026 11:44:15 +0200 Subject: [PATCH 1/2] Add a regression test for renamed-Phar config template resolution A Phar renamed away from `wp-cli.phar` used to build malformed template paths when generating a wp-config.php for an install in another directory via --path, failing with "wp-config.mustache is not a file in phar". Add a Bootstrap scenario that copies the freshly built Phar to a name without an extension and runs `config create --path=subfolder` against a separate install, so the fixed behavior is locked in and regressions are caught. The fix itself lives in wp-cli/wp-cli's Path::phar_safe(), which the bundled Phar picks up through the framework. See wp-cli/config-command#141. --- features/bootstrap.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/features/bootstrap.feature b/features/bootstrap.feature index b2ef01e7a..fbeb46854 100644 --- a/features/bootstrap.feature +++ b/features/bootstrap.feature @@ -81,3 +81,20 @@ Feature: Bootstrap WP-CLI Status: Inactive """ And STDERR should be empty + + Scenario: Config template resolves when the PHAR is renamed and run against another path + + # Reproduces the reported failure: a Phar renamed away from `wp-cli.phar` + # (here without an extension) generating a wp-config.php for an install in a + # different directory via --path. See https://github.com/wp-cli/config-command/issues/141 + Given an empty directory + And a new Phar with the same version + + When I run `cp {PHAR_PATH} wp-renamed` + And I run `php wp-renamed core download --path=subfolder` + And I run `php wp-renamed config create --path=subfolder --dbname=wordpress --dbuser=root --dbpass=password --skip-check` + Then STDOUT should contain: + """ + Success: Generated 'wp-config.php' file. + """ + And STDERR should be empty From 6bc67e4c42ee2eddf8efbb5431d5a2def87aa3a1 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 21 Jul 2026 16:09:38 +0200 Subject: [PATCH 2/2] Bump wp-cli/wp-cli to include the renamed-Phar path fix Updates the pinned dev-main reference to 63fb80e (wp-cli/wp-cli#6242), which makes `Path::phar_safe()` resolve templates and assets correctly for a Phar renamed off `wp-cli.phar`. This turns the Bootstrap Behat scenario added in this PR green. --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index a34612c82..67a389090 100644 --- a/composer.lock +++ b/composer.lock @@ -2674,12 +2674,12 @@ "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "a39887a1f76578e5df9c22342b249fd30cdf99fe" + "reference": "63fb80efceb323f3174c53d6b2a0f42ea4d7c6a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/a39887a1f76578e5df9c22342b249fd30cdf99fe", - "reference": "a39887a1f76578e5df9c22342b249fd30cdf99fe", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/63fb80efceb323f3174c53d6b2a0f42ea4d7c6a1", + "reference": "63fb80efceb323f3174c53d6b2a0f42ea4d7c6a1", "shasum": "" }, "require": { @@ -2751,7 +2751,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2026-07-21T12:11:18+00:00" + "time": "2026-07-21T14:08:04+00:00" }, { "name": "wp-cli/wp-config-transformer", @@ -9811,5 +9811,5 @@ "platform-overrides": { "php": "7.2.24" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" }