Bug #66771 [Opn->Fbk]: exif_read_data returns malformed array
| From: | kalle@php.net | Date: | Fri, 05 Aug 2016 06:00:36 +0000 |
| Subject: | Bug #66771 [Opn->Fbk]: exif_read_data returns malformed array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202937@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66771&edit=1
ID: 66771
Updated by: kalle@php.net
Reported by: peter at oncefuture dot com
Summary: exif_read_data returns malformed array
-Status: Open
+Status: Feedback
Type: Bug
Package: EXIF related
Operating System: Linux
PHP Version: 5.4.25
Block user comment: N
Private report: N
New Comment:
Please try using this snapshot:
http://snaps.php.net/php-trunk-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Could you try to check with the recent fixes made to exif from the master branch, which will
eventually turn into 7.2 if these have fixed the issue? I have recently added support for Samsung as
one of the mentioned formats.
Side note, some editors can cause some exif data to be saved incorrectly due to their offsets that
varies, and they are not bound to the header of the file either hence why some editors can
potentially cause loss of exif data or corrupted data which is sadly out of our hands to fix.
Previous Comments:
------------------------------------------------------------------------
[2014-02-26 00:18:49] chrispmaiden at gmail dot com
I'm not sure I am testing this correctly but I cannot reproduce this.
I download 5.4.25 source code and did the following:
./configure --prefix=/home/matason/php --enable-exif
make
make install
Then I created a PHP file:
<?php
// /home/matason/exif-test.php
$exif = exif_read_data('/home/matason/Downloads/images/Samsung Galaxy S3 (1).jpg');
print_r($exif);
And ran it with:
/home/matason/php/bin/php -f /home/matason/exif-test.php
And here's the output (note that it includes the closing paren):
Array
(
[FileName] => Samsung Galaxy S3 (1).jpg
[FileDateTime] => 1363958740
[FileSize] => 1811414
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP
[COMPUTED] => Array
(
[html] => width="3264" height="2448"
[Height] => 2448
[Width] => 3264
[IsColor] => 1
[ByteOrderMotorola] => 0
[ApertureFNumber] => f/2.6
[UserComment] => �;
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
[Thumbnail.Height] => 120
[Thumbnail.Width] => 160
)
[ImageWidth] => 3264
[ImageLength] => 2448
[Make] => SAMSUNG
[Model] => GT-I9300
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[Software] => I9300XXEMA2
[DateTime] => 2013:03:22 08:25:41
[YCbCrPositioning] => 1
[Exif_IFD_Pointer] => 224
[THUMBNAIL] => Array
(
[ImageWidth] => 160
[ImageLength] => 120
[Compression] => 6
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 5046
[JPEGInterchangeFormatLength] => 7730
)
[ExposureTime] => 1/1444
[FNumber] => 26/10
[ExposureProgram] => 3
[ISOSpeedRatings] => 80
[ExifVersion] => 0220
[DateTimeOriginal] => 2013:03:22 08:25:41
[DateTimeDigitized] => 2013:03:22 08:25:41
[ComponentsConfiguration] =>
[ShutterSpeedValue] => 2687/256
[ApertureValue] => 276/100
[BrightnessValue] => 2234/256
[ExposureBiasValue] => 0/10
[MaxApertureValue] => 276/100
[MeteringMode] => 2
[Flash] => 0
[FocalLength] => 37/10
[MakerNote] => 0100 @P
Z
[UserComment] => �;K
�xV4xV4xV4xV4`A9�@
������CALGDFD06Cur.GDFI02CML018001001509002901090502010D010D010D090D� �&TUNA��
XX t l����U��w����EK�����
��� US����FLFLSVN#
RX X R y Z ^JV�
8JKJK���x�}� "
B��
X g"��t
l����U��w����EK�����
US����JKJK""""""""""""""""""""""""!""""""!"!"!"""""""""""���!"!"!"!"!"!"!"""!"!"!"!"!"������������ �� �� �� �� �� �� �� ������ �� �� �� �� �� �� �� ����� �� �� �� ������������� �� ��������������� �� �� ������������� �� �� �� �� ����������� �� �� �� �� �� �� ���������� �� �� �� �� �� �� �� JKJK�%��*�lM����>�V%��"���"���"���
)AFAFAFAF=G (AFAFް�
�xR�)�)�ss\&�Ƴ6n������ÎFßW�޼���40��
@7�>
[FlashPixVersion] => 0100
[ColorSpace] => 1
[ExifImageWidth] => 3264
[ExifImageLength] => 2448
[InteroperabilityOffset] => 4886
[ExposureMode] => 0
[WhiteBalance] => 0
[SceneCaptureType] => 0
[ImageUniqueID] => GDFI02
[InterOperabilityIndex] => R98
[InterOperabilityVersion] => 0100
)
------------------------------------------------------------------------
[2014-02-25 18:19:38] peter at oncefuture dot com
Description:
------------
exif_read_data returns malformed arrays (missing a closing parens) when reading from certain image
files that come straight out of the camera (ie. no processing in any image manipulation/management
program like photoshop). I can reproduce this on files from Samsung, Nikon, etc.
Test script:
---------------
$exif = @exif_read_data( $file );
print_r($exif, true);
Test image files are here: http://goo.gl/Ry5fG6
Expected result:
----------------
Produces a malformed array without a closing paren:
Array
(
[FileName] => Samsung-Galaxy-S3-123.jpg
[FileDateTime] => 1393350070
[FileSize] => 1811414
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP
[COMPUTED] => Array
(
[html] => width="3264" height="2448"
[Height] => 2448
[Width] => 3264
[IsColor] => 1
[ByteOrderMotorola] => 0
[ApertureFNumber] => f/2.6
[UserComment] => ø;
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
[Thumbnail.Height] => 120
[Thumbnail.Width] => 160
)
[ImageWidth] => 3264
[ImageLength] => 2448
[Make] => SAMSUNG
[Model] => GT-I9300
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[Software] => I9300XXEMA2
[DateTime] => 2013:03:22 08:25:41
[YCbCrPositioning] => 1
[Exif_IFD_Pointer] => 224
[THUMBNAIL] => Array
(
[ImageWidth] => 160
[ImageLength] => 120
[Compression] => 6
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 5046
[JPEGInterchangeFormatLength] => 7730
)
[ExposureTime] => 1/1444
[FNumber] => 26/10
[ExposureProgram] => 3
[ISOSpeedRatings] => 80
[ExifVersion] => 0220
[DateTimeOriginal] => 2013:03:22 08:25:41
[DateTimeDigitized] => 2013:03:22 08:25:41
[ComponentsConfiguration] =>
)
Actual result:
--------------
Array
(
[FileName] => Samsung-Galaxy-S3-123.jpg
[FileDateTime] => 1393350070
[FileSize] => 1811414
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP
[COMPUTED] => Array
(
[html] => width="3264" height="2448"
[Height] => 2448
[Width] => 3264
[IsColor] => 1
[ByteOrderMotorola] => 0
[ApertureFNumber] => f/2.6
[UserComment] => ø;
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
[Thumbnail.Height] => 120
[Thumbnail.Width] => 160
)
[ImageWidth] => 3264
[ImageLength] => 2448
[Make] => SAMSUNG
[Model] => GT-I9300
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[Software] => I9300XXEMA2
[DateTime] => 2013:03:22 08:25:41
[YCbCrPositioning] => 1
[Exif_IFD_Pointer] => 224
[THUMBNAIL] => Array
(
[ImageWidth] => 160
[ImageLength] => 120
[Compression] => 6
[Orientation] => 1
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 5046
[JPEGInterchangeFormatLength] => 7730
)
[ExposureTime] => 1/1444
[FNumber] => 26/10
[ExposureProgram] => 3
[ISOSpeedRatings] => 80
[ExifVersion] => 0220
[DateTimeOriginal] => 2013:03:22 08:25:41
[DateTimeDigitized] => 2013:03:22 08:25:41
[ComponentsConfiguration] =>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66771&edit=1