From 85474494b12f606687ce59c1daaaec36c308f839 Mon Sep 17 00:00:00 2001 From: LamGC Date: Tue, 13 Oct 2026 18:06:18 +0800 Subject: [PATCH] Document bounded temporary-upload stream exceptions --- includes/uploads.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/uploads.php b/includes/uploads.php index 34ded26..961065a 100644 --- a/includes/uploads.php +++ b/includes/uploads.php @@ -130,7 +130,8 @@ function is_valid_cast_file( $path ) { if ( ! is_string( $path ) || '' === $path || false !== strpos( $path, '://' ) || ! is_file( $path ) || ! is_readable( $path ) ) { return false; } - $handle = fopen( $path, 'rb' ); + // Read-only local upload validation needs bounded streaming; WP_Filesystem reads whole files. + $handle = fopen( $path, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Local temporary upload only; wrappers rejected above. if ( false === $handle ) { return false; } @@ -180,7 +181,7 @@ function is_valid_cast_file( $path ) { } return feof( $handle ); } finally { - fclose( $handle ); + fclose( $handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Always close the bounded read-only upload stream. } }