Make WordPress Core

Ticket #55069: 0004-functions.php-use-file_get_contents-in-wp_get_image_.patch

File 0004-functions.php-use-file_get_contents-in-wp_get_image_.patch, 1018 bytes (added by maxkellermann, 3 years ago)
  • src/wp-includes/functions.php

    From 2bda4cf819ba20181a30892c5ca7fb29abd9ff52 Mon Sep 17 00:00:00 2001
    From: Max Kellermann <mk@cm4all.com>
    Date: Fri, 4 Feb 2022 16:42:21 +0100
    Subject: [PATCH 4/5] functions.php: use file_get_contents() in
     wp_get_image_mime()
    
    ---
     src/wp-includes/functions.php | 9 +--------
     1 file changed, 1 insertion(+), 8 deletions(-)
    
    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index f0349490f1..32034d26df 100644
    a b function wp_get_image_mime( $file ) { 
    32273227                        return $mime;
    32283228                }
    32293229
    3230                 $handle = fopen( $file, 'rb' );
    3231                 if ( false === $handle ) {
    3232                         return false;
    3233                 }
    3234 
    3235                 $magic = fread( $handle, 12 );
     3230                $magic = file_get_contents( $file, false, null, 0, 12 );
    32363231                if ( false === $magic ) {
    32373232                        return false;
    32383233                }
    function wp_get_image_mime( $file ) { 
    32513246                ) {
    32523247                        $mime = 'image/webp';
    32533248                }
    3254 
    3255                 fclose( $handle );
    32563249        } catch ( Exception $e ) {
    32573250                $mime = false;
    32583251        }