rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
221 stars 63 forks source link

PHP 8.1+ ErrorException Warning: Undefined variable $filePath #587

Closed portalzine closed 10 months ago

portalzine commented 1 year ago

/wp-content/plugins/webp-express/lib/classes/Mime.php in WebPExpress\Mime::getMimeTypeOfMedia at line 39


 if (function_exists('wp_check_filetype')) { // introduced in 2.0.4
            // Try wordpress method, which simply uses the file extension and a map
            $mimeType = wp_check_filetype($filePath)['type'];
            if ($mimeType !== false) {
                return $mimeType;
            }
        }

ErrorException happens, when uploading files through the update system (themes or plugins) Cheers Alexander

gerasart commented 10 months ago

i think need fix $filePath -> $filename

rosell-dk commented 10 months ago

Thanks for the PR, @gerasart ! It will be part of the next release, which won't be long