Make WordPress Core

Ticket #55069: 0005-media.php-use-file_get_contents-in-wp_get_webp_info.patch

File 0005-media.php-use-file_get_contents-in-wp_get_webp_info.patch, 909 bytes (added by maxkellermann, 3 years ago)
  • src/wp-includes/media.php

    From 3037637d8fcf7661c028b0fe852f3c6e924dc142 Mon Sep 17 00:00:00 2001
    From: Max Kellermann <mk@cm4all.com>
    Date: Fri, 4 Feb 2022 16:43:57 +0100
    Subject: [PATCH 5/5] media.php: use file_get_contents() in wp_get_webp_info()
    
    ---
     src/wp-includes/media.php | 7 ++-----
     1 file changed, 2 insertions(+), 5 deletions(-)
    
    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 6e7f66760f..d6786a1352 100644
    a b function wp_get_webp_info( $filename ) { 
    51335133        }
    51345134
    51355135        try {
    5136                 $handle = fopen( $filename, 'rb' );
    5137                 if ( $handle ) {
    5138                         $magic = fread( $handle, 40 );
    5139                         fclose( $handle );
    5140 
     5136                $magic = file_get_contents( $filename, false, null, 0, 40 );
     5137                if ( $magic !== false ) {
    51415138                        // Make sure we got enough bytes.
    51425139                        if ( strlen( $magic ) < 40 ) {
    51435140                                return compact( 'width', 'height', 'type' );