Skip to content

Commit

Permalink
fix(files): memory usage in filter_wp_read_image_metadata()
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jun 13, 2024
1 parent 3946a73 commit 21941aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions files/class-vip-filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ public function filter_wp_read_image_metadata( $meta, $file ) {

// Save a local copy and read metadata from that
$temp_file = wp_tempnam();
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents, WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
file_put_contents( $temp_file, file_get_contents( $file ) );
copy( $file, $temp_file );
$meta = wp_read_image_metadata( $temp_file );

add_filter( 'wp_read_image_metadata', [ $this, 'filter_wp_read_image_metadata' ], 10, 2 );
Expand Down

0 comments on commit 21941aa

Please sign in to comment.