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 ) { |
3227 | 3227 | return $mime; |
3228 | 3228 | } |
3229 | 3229 | |
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 ); |
3236 | 3231 | if ( false === $magic ) { |
3237 | 3232 | return false; |
3238 | 3233 | } |
… |
… |
function wp_get_image_mime( $file ) { |
3251 | 3246 | ) { |
3252 | 3247 | $mime = 'image/webp'; |
3253 | 3248 | } |
3254 | | |
3255 | | fclose( $handle ); |
3256 | 3249 | } catch ( Exception $e ) { |
3257 | 3250 | $mime = false; |
3258 | 3251 | } |