Document bounded temporary-upload stream exceptions
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s

This commit is contained in:
2026-10-13 18:06:18 +08:00
parent 04f19543d3
commit 85474494b1
+3 -2
View File
@@ -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.
}
}