Commit 20f9e20e99 for wordpress.org
commit 20f9e20e9969470ccb9a6f5930c8875566e40afb
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Thu Oct 29 10:47:58 2026 +0000
Filesystem API: Avoid a fatal error in PclZip when the temporary file cannot be created.
`PclZip::privExtractFileUsingTempFile()` calls `fclose( $v_file )` when it fails to open its temporary file, but `$v_file` is not defined in that function. On PHP 8, `fclose( null )` throws a `TypeError`, so the request dies with a fatal error instead of returning an error with `PCLZIP_ERR_WRITE_OPEN_FAIL`. Nothing has been opened at that point, so the call is removed.
The similar `fclose( $v_file )` in `privAddFileUsingTempFile()` is correct (the file is opened a few lines above) and is left unchanged.
Developed in https://github.com/WordPress/wordpress-develop/pull/15133.
Follow-up to r11056.
Props ExtremsX.
Fixes #66408.
Built from https://develop.svn.wordpress.org/trunk@65003
git-svn-id: http://core.svn.wordpress.org/trunk@64153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/class-pclzip.php b/wp-admin/includes/class-pclzip.php
index e8eb37ddd8..1a77eeefbc 100644
--- a/wp-admin/includes/class-pclzip.php
+++ b/wp-admin/includes/class-pclzip.php
@@ -3981,7 +3981,6 @@
// ----- Creates a temporary file
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
- fclose($v_file);
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
return PclZip::errorCode();
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 5742c9c52f..2984f33dbc 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta3-65002';
+$wp_version = '7.2-beta3-65003';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.