|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76521 getimagesize() fails on photos from Samsung S8
Submitted: 2018-06-22 13:20 UTC Modified: 2018-06-22 15:18 UTC
From: opajaap at opajaap dot nl Assigned: cmb (profile)
Status: Duplicate Package: GetImageSize related
PHP Version: 7.1.18 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: opajaap at opajaap dot nl
New email:
PHP Version: OS:


 [2018-06-22 13:20 UTC] opajaap at opajaap dot nl
Seen on PHP 7.1.13 and 7.2.5

getimagesize() executed on a just uploaded photofile from a Samsung S8 phone does not return an array.

Url to sample photo:

Test script:
// $file = <filepath to just uploaded photofile (.jpg) 

$src_size = @getimagesize( $file, $info );

// If the given file is not an image file, log error and exit
if ( ! $src_size ) {
	echo ( sprintf( 'ERROR: File %s is not a valid picture file.', $file ) );
	return false;

// This prints the errormessage, while the photo looks normal on a windows pc


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-22 13:24 UTC]
What is the actually error getimagesize returns?
 [2018-06-22 14:19 UTC]
-Status: Open +Status: Verified -Package: GD related +Package: GetImageSize related -Assigned To: +Assigned To: cmb
 [2018-06-22 14:19 UTC]
I can reproduce this on current PHP-7.2.  As soon as the
$imageinfo parameter is given, getimagesize() returns FALSE
without any notice/warning.
 [2018-06-22 14:19 UTC]
-Status: Verified +Status: Feedback -Package: GetImageSize related +Package: GD related -Assigned To: cmb +Assigned To:
 [2018-06-22 14:19 UTC]
Works for me.

    [0] => 4032
    [1] => 3024
    [2] => 2
    [3] => width="4032" height="3024"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg

The @ will hide errors. If you have a problem then hiding errors is not good. Remove the @.
 [2018-06-22 14:20 UTC]
-Status: Feedback +Status: Verified -Package: GD related +Package: GetImageSize related -Assigned To: +Assigned To: cmb
 [2018-06-22 14:20 UTC]
Then this bug sounds familiar...
 [2018-06-22 14:23 UTC]
Here we go. You probably recognize it too: bug #71848 and/or bug #75708.
 [2018-06-22 15:18 UTC]
-Status: Verified +Status: Duplicate
 [2018-06-22 15:18 UTC]
Thanks!  Indeed this is a duplicate of the former bug; this image
also contains an empty APP5 segment (starting at 0x67E6).
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 20:01:28 2023 UTC