Bug #62681 [Ana->Nab]: mime_content_type gets wrong mime

From: Date: Mon, 16 Aug 2021 12:57:28 +0000
Subject: Bug #62681 [Ana->Nab]: mime_content_type gets wrong mime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235849@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62681&edit=1 ID: 62681 Updated by: cmb@php.net Reported by: BenjaminBeck at gmx dot de Summary: mime_content_type gets wrong mime -Status: Analyzed +Status: Not a bug Type: Bug Package: Unknown/Other Function Operating System: ubuntu PHP Version: 5.3.15 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: If this issue still persists, please report it upstream[1]. [1] <https://www.darwinsys.com/file/> Previous Comments: ------------------------------------------------------------------------ [2012-07-28 14:14:52] rasmus@php.net This is because your picture is not standard JPEG/JFIF but instead JPEG/EXIF. The command-line Linux 'file' program doesn't understand it either: 7:03am x220:~> file 7.jpeg 7.jpeg: Claris clip art? You can get it using: var_dump(image_type_to_mime_type(exif_imagetype("7.jpeg"))) which produces: image/jpeg But yes, we should support non-JFIF jpeg files as well here. ------------------------------------------------------------------------ [2012-07-28 09:44:07] BenjaminBeck at gmx dot de my system configuration which produced the bug is: PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 03:26:01) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies ------------------------------------------------------------------------ [2012-07-28 09:42:13] BenjaminBeck at gmx dot de Description: ------------ PHP function "mime_content_type" returns wrong mime type: "application/octet-stream" instead of "image/jpeg" on a jpg image. I checked the magic bytes (jpeg header) of the file with a hex editor and it looked fine to me. the image is taken by a smartfone (HTC 7 Mozart T8698). this is the image: http://dl.dropbox.com/u/25310351/7.jpeg Test script: --------------- $res = mime_content_type("7.jpg"); var_dump($res); Expected result: ---------------- image/jpeg Actual result: -------------- application/octet-stream ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62681&edit=1

« previous php.bugs (#235849) next »