File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -670,7 +670,10 @@ public static function download_fragment( $url, $size = 1048576 ) {
670670 if ( empty ( $ index ) ) {
671671 add_action ( 'shutdown ' , array ( __CLASS__ , 'purge_fragments ' ) );
672672 }
673- self ::$ file_fragments [ $ index ] = $ temp_file ;
673+ self ::$ file_fragments [ $ index ] = array (
674+ 'pointer ' => $ pointer ,
675+ 'file ' => $ temp_file ,
676+ );
674677 // Get the metadata of the stream.
675678 $ data = stream_get_meta_data ( $ pointer );
676679 // Stream the content to the temp file.
@@ -710,8 +713,8 @@ public static function purge_fragments() {
710713 */
711714 public static function purge_fragment ( $ index ) {
712715 if ( isset ( self ::$ file_fragments [ $ index ] ) ) {
713- fclose ( self ::$ file_fragments [ $ index ] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
714- unset ( self ::$ file_fragments [ $ index ] );
716+ fclose ( self ::$ file_fragments [ $ index ][ ' pointer ' ] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
717+ unlink ( self ::$ file_fragments [ $ index ][ ' file ' ] );
715718 }
716719 }
717720
You can’t perform that action at this time.
0 commit comments