From 35470ab04842bc114db9d549a9e1676a1b6c7cf5 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:25 +0000 Subject: [PATCH 1/2] Initial plan From ebba7f6c01d6970b8d6311d5e669125ec1a2be78 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:35 +0000 Subject: [PATCH 2/2] Use Utils\make_temp_file() for core temp paths Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com> --- src/Core_Command.php | 4 ++-- src/WP_CLI/Core/CoreUpgrader.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Core_Command.php b/src/Core_Command.php index 7fe7e9d0..9cb0a0b9 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -298,7 +298,7 @@ public function download( $args, $assoc_args ) { } if ( ! $cache_file || $bad_cache ) { - $temp = Utils\get_temp_dir() . uniqid( 'wp_' ) . '.tmp'; + $temp = Utils\make_temp_file( 'wp_', '.tmp' ); register_shutdown_function( function () use ( &$temp ) { if ( file_exists( $temp ) ) { @@ -2242,7 +2242,7 @@ private function remove_directory( $dir, $abspath_realpath_trailing ) { } private static function strip_content_dir( $zip_file ) { - $new_zip_file = Utils\get_temp_dir() . uniqid( 'wp_' ) . '.zip'; + $new_zip_file = Utils\make_temp_file( 'wp_', '.zip' ); register_shutdown_function( function () use ( $new_zip_file ) { if ( file_exists( $new_zip_file ) ) { diff --git a/src/WP_CLI/Core/CoreUpgrader.php b/src/WP_CLI/Core/CoreUpgrader.php index d8b266c3..56623f40 100644 --- a/src/WP_CLI/Core/CoreUpgrader.php +++ b/src/WP_CLI/Core/CoreUpgrader.php @@ -84,7 +84,7 @@ public function download_package( $package, $check_signatures = false, $hook_ext $filename = pathinfo( $package, PATHINFO_FILENAME ); $extension = pathinfo( $package, PATHINFO_EXTENSION ); - $temp = Utils\get_temp_dir() . uniqid( 'wp_' ) . ".{$extension}"; + $temp = Utils\make_temp_file( 'wp_', ".{$extension}" ); register_shutdown_function( function () use ( $temp ) { if ( file_exists( $temp ) ) {