php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: opajaap at opajaap dot nl
New email:
PHP Version: OS:

 

 [2018-06-22 13:20 UTC] opajaap at opajaap dot nl
Description:
------------
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: 
https://betatest.opajaap.nl/wp-content/wppa-depot/20180522_102730.jpg


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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-22 13:24 UTC] peehaa@php.net
What is the actually error getimagesize returns?
 [2018-06-22 14:19 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: GD related +Package: GetImageSize related -Assigned To: +Assigned To: cmb
 [2018-06-22 14:19 UTC] cmb@php.net
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] requinix@php.net
-Status: Verified +Status: Feedback -Package: GetImageSize related +Package: GD related -Assigned To: cmb +Assigned To:
 [2018-06-22 14:19 UTC] requinix@php.net
Works for me.

Array
(
    [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] requinix@php.net
-Status: Feedback +Status: Verified -Package: GD related +Package: GetImageSize related -Assigned To: +Assigned To: cmb
 [2018-06-22 14:20 UTC] requinix@php.net
Then this bug sounds familiar...
 [2018-06-22 14:23 UTC] requinix@php.net
Here we go. You probably recognize it too: bug #71848 and/or bug #75708.
 [2018-06-22 15:18 UTC] cmb@php.net
-Status: Verified +Status: Duplicate
 [2018-06-22 15:18 UTC] cmb@php.net
Thanks!  Indeed this is a duplicate of the former bug; this image
also contains an empty APP5 segment (starting at 0x67E6).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC