From 2b5276413b88b05f3d645ced878cc7f8ade11990 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:55:12 +0000 Subject: [PATCH 1/6] Initial plan From d1a10fac4c730cd589bd1cfa2d030096c65b1389 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:57:47 +0000 Subject: [PATCH 2/6] Use WP-CLI temp helpers for zip install paths Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- features/package-install.feature | 19 +++++++++++++++++++ src/Package_Command.php | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/features/package-install.feature b/features/package-install.feature index 262e93d1..006d97ce 100644 --- a/features/package-install.feature +++ b/features/package-install.feature @@ -1017,6 +1017,25 @@ Feature: Install WP-CLI packages wp-cli/google-sitemap-generator-cli """ + @github-api + Scenario: Install a package from a remote zip URL + Given an empty directory + + When I run `wp package install https://github.com/wp-cli/google-sitemap-generator-cli/archive/main.zip` + Then STDOUT should contain: + """ + Installing package wp-cli/google-sitemap-generator-cli + """ + And STDOUT should contain: + """ + Success: Package installed. + """ + + When I run `wp package is-installed wp-cli/google-sitemap-generator-cli` + Then the return code should be 0 + And STDERR should be empty + And STDOUT should be empty + @github-api Scenario: Install a package from Git using a shortened mixed-case package identifier but lowercase composer.json name Given an empty directory diff --git a/src/Package_Command.php b/src/Package_Command.php index 81621306..0d08d832 100644 --- a/src/Package_Command.php +++ b/src/Package_Command.php @@ -276,7 +276,7 @@ public function install( $args, $assoc_args ) { // Download the remote ZIP file to a temp directory $temp = false; if ( false !== strpos( $package_name, '://' ) ) { - $temp = Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true /*more_entropy*/ ) . '.zip'; + $temp = Utils\make_temp_file( 'wp-cli-package_', '.zip' ); $options = [ 'timeout' => 600, 'filename' => $temp, @@ -291,7 +291,7 @@ public function install( $args, $assoc_args ) { } $package_name = $temp; } - $dir_package = Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true /*more_entropy*/ ); + $dir_package = Utils\make_temp_dir( 'wp-cli-package_' ); try { // Extract the package to get the package name Extractor::extract( $package_name, $dir_package ); From 9cfe53baa8ebb58d036ee7967f6bee0e1220ecdf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:58:31 +0000 Subject: [PATCH 3/6] Add remote zip install failure-path coverage Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- features/package-install.feature | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/features/package-install.feature b/features/package-install.feature index 006d97ce..b1f487ad 100644 --- a/features/package-install.feature +++ b/features/package-install.feature @@ -1036,6 +1036,21 @@ Feature: Install WP-CLI packages And STDERR should be empty And STDOUT should be empty + Scenario: Install from a remote zip URL with invalid zip contents + Given an empty directory + And an invalid.zip file: + """ + this is not a zip archive + """ + And a PHP built-in web server + + When I try `wp package install http://localhost:8080/invalid.zip` + Then the return code should be 1 + And STDERR should contain: + """ + ZipArchive failed to unzip + """ + @github-api Scenario: Install a package from Git using a shortened mixed-case package identifier but lowercase composer.json name Given an empty directory From 7ef81ca04986afb3b4bca106235a471ac81dfb58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:58:57 +0000 Subject: [PATCH 4/6] Add remote zip fetch failure acceptance test Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- features/package-install.feature | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/features/package-install.feature b/features/package-install.feature index b1f487ad..c550e8e8 100644 --- a/features/package-install.feature +++ b/features/package-install.feature @@ -1051,6 +1051,17 @@ Feature: Install WP-CLI packages ZipArchive failed to unzip """ + Scenario: Install from a remote zip URL that returns 404 + Given an empty directory + And a PHP built-in web server + + When I try `wp package install http://localhost:8080/missing.zip` + Then the return code should be 1 + And STDERR should contain: + """ + Couldn't download package from 'http://localhost:8080/missing.zip' (HTTP code 404). + """ + @github-api Scenario: Install a package from Git using a shortened mixed-case package identifier but lowercase composer.json name Given an empty directory From 6ef07c984c2c21a8e8533f2d9a38385ccefef8cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:59:34 +0000 Subject: [PATCH 5/6] Use local fixture for remote zip success test Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- features/package-install.feature | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/features/package-install.feature b/features/package-install.feature index c550e8e8..3f24dad1 100644 --- a/features/package-install.feature +++ b/features/package-install.feature @@ -1017,21 +1017,30 @@ Feature: Install WP-CLI packages wp-cli/google-sitemap-generator-cli """ - @github-api Scenario: Install a package from a remote zip URL Given an empty directory + And a remote-zip-test-command/composer.json file: + """ + { + "name": "wp-cli-test/remote-zip-test-command", + "description": "Dummy package served over HTTP as a ZIP archive for acceptance tests.", + "type": "wp-cli-package" + } + """ + And I run `php -r '$zip = new ZipArchive(); $zip->open( "remote-zip-test-command.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE ); $zip->addFromString( "remote-zip-test-command/composer.json", file_get_contents( "remote-zip-test-command/composer.json" ) ); $zip->close();'` + And a PHP built-in web server - When I run `wp package install https://github.com/wp-cli/google-sitemap-generator-cli/archive/main.zip` + When I run `wp package install http://localhost:8080/remote-zip-test-command.zip` Then STDOUT should contain: """ - Installing package wp-cli/google-sitemap-generator-cli + Installing package wp-cli-test/remote-zip-test-command """ And STDOUT should contain: """ Success: Package installed. """ - When I run `wp package is-installed wp-cli/google-sitemap-generator-cli` + When I run `wp package is-installed wp-cli-test/remote-zip-test-command` Then the return code should be 0 And STDERR should be empty And STDOUT should be empty From 23066fb982c6f674da6028f6c5eb2919e07525c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Sep 2026 22:00:06 +0000 Subject: [PATCH 6/6] Cover flat-layout remote zip package install Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- features/package-install.feature | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/features/package-install.feature b/features/package-install.feature index 3f24dad1..d8a5660e 100644 --- a/features/package-install.feature +++ b/features/package-install.feature @@ -1045,6 +1045,34 @@ Feature: Install WP-CLI packages And STDERR should be empty And STDOUT should be empty + Scenario: Install a package from a remote zip URL with files at archive root + Given an empty directory + And a composer-flat.json file: + """ + { + "name": "wp-cli-test/remote-zip-flat-command", + "description": "Dummy flat-layout ZIP package for acceptance tests.", + "type": "wp-cli-package" + } + """ + And I run `php -r '$zip = new ZipArchive(); $zip->open( "remote-zip-flat-command.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE ); $zip->addFromString( "composer.json", file_get_contents( "composer-flat.json" ) ); $zip->close();'` + And a PHP built-in web server + + When I run `wp package install http://localhost:8080/remote-zip-flat-command.zip` + Then STDOUT should contain: + """ + Installing package wp-cli-test/remote-zip-flat-command + """ + And STDOUT should contain: + """ + Success: Package installed. + """ + + When I run `wp package is-installed wp-cli-test/remote-zip-flat-command` + Then the return code should be 0 + And STDERR should be empty + And STDOUT should be empty + Scenario: Install from a remote zip URL with invalid zip contents Given an empty directory And an invalid.zip file: