Bug #75785 [Com]: Many errors from exif_read_data

From: Date: Tue, 23 Oct 2018 09:45:43 +0000
Subject: Bug #75785 [Com]: Many errors from exif_read_data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217664@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75785&edit=1

 ID:                 75785
 Comment by:         mike dot blomgren at tornado dot se
 Reported by:        opajaap at opajaap dot nl
 Summary:            Many errors from exif_read_data
 Status:             Assigned
 Type:               Bug
 Package:            EXIF related
 Operating System:   unknown
 PHP Version:        7.2.1
 Assigned To:        kalle
 Block user comment: N
 Private report:     N

 New Comment:

exif_read_data does not read all EXIF information in certain JPEG files.

Sample JPG here, that has the problem:
https://www.tornado.se/piwigo/tools/sample.jpg

Using exif_read_data produces the following output of 'sample.jpg':
https://www.tornado.se/piwigo/tools/metadata.php

I.e. it is not complete (using print_r and var_dump). The apache server produces the followong
errors in error_log:

[Tue Oct 23 11:38:47.425214 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP Warning:
 read_exif_data(sample.jpg): Process tag(x010D=DocumentNam): Illegal components(0) in
/var/wwwtornado/htdocs/piwigo/tools/metadata.php on line 93
[Tue Oct 23 11:38:47.425234 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP Stack
trace:
[Tue Oct 23 11:38:47.425240 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP   1.
{main}() /var/wwwtornado/htdocs/piwigo/tools/metadata.php:0
[Tue Oct 23 11:38:47.425243 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP   2.
read_exif_data() /var/wwwtornado/htdocs/piwigo/tools/metadata.php:93
[Tue Oct 23 11:38:47.425353 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP Notice: 
Undefined index: IFD0 in /var/wwwtornado/htdocs/piwigo/tools/metadata.php on line 110
[Tue Oct 23 11:38:47.425364 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP Stack
trace:
[Tue Oct 23 11:38:47.425370 2018] [php7:notice] [pid 3514] [client 195.198.34.135:1104] PHP   1.
{main}() /var/wwwtornado/htdocs/piwigo/tools/metadata.php:0

Using exif_read_data seems to 'cut' up to a certain point of the EXIF header. Specifically
I want to extract the DateTimeOriginal value, but php 7.2.11 isn't able to find the value.
Using jhead or exiftool fully decodes all the EXIF headers.


Previous Comments:
------------------------------------------------------------------------
[2018-10-17 22:08:54] gino0631 at centaurus dot cloud

It seems this issue is still present in PHP 7.2.11, e.g. with the sample image provided in this
comment: https://github.com/gino0631/nextcloud-metadata/issues/19#issuecomment-414079570

------------------------------------------------------------------------
[2018-07-25 07:24:28] jbe at geo6 dot be

I have the same issue since a few days.

Here is my PHP version :

PHP 7.2.7-2+0~20180714182401.1+jessie~1.gbp3fcba8 (cli) (built: Jul 15 2018 13:57:20) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.7-2+0~20180714182401.1+jessie~1.gbp3fcba8, Copyright (c) 1999-2018, by
Zend Technologies

------------------------------------------------------------------------
[2018-07-17 15:55:09] kalle@php.net

Thanks for the zip! I will try take a look if there is something obviously wrong in ext/exif.

Ps. I think the reason its fixed in newer versions is due to stas@ security fixes that could have
flipped the coin and actually make them work.

------------------------------------------------------------------------
[2018-07-17 09:26:34] opajaap at opajaap dot nl

Sorry, they are no longer there. Try https://betatest.opajaap.nl/wp-content/wppa-depot/opajaap/phpbug.zip
this zip contains 5 of them.

FYI: Seems to be fixed in php 7.2.7

------------------------------------------------------------------------
[2018-07-16 14:32:54] kalle@php.net

Hi, whenever I try to access the linked .jpg's, I get a WP login page, any chance you can share
them in a non protected space or zip them all?

Thanks

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=75785


--
Edit this bug report at https://bugs.php.net/bug.php?id=75785&edit=1


Thread (14 messages)

« previous php.bugs (#217664) next »