|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50660 exif_read_data(): Illegal IFD offset (works fine with other exif readers)
Submitted: 2010-01-04 17:55 UTC Modified: 2019-02-12 15:48 UTC
Avg. Score:4.0 ± 0.9
Reproduced:22 of 22 (100.0%)
Same Version:11 (50.0%)
Same OS:11 (50.0%)
From: skinny dot bravo at gmail dot com Assigned: kalle (profile)
Status: Closed Package: EXIF related
PHP Version: 5.*, 6, 7.1.26 OS: Linux
Private report: No CVE-ID: None
 [2010-01-04 17:55 UTC] skinny dot bravo at gmail dot com
PHP fails reading GPS data from a given set of photos from Samsung SGH-
i900. The images are said to come from the camera without any edits.


exiftool 8.00 has no problem reading this file. php5.2-201001041530 
the same result.

Reproduce code:
# php -r 'var_dump(read_exif_data("16095163cDU.jpg",NULL,TRUE));'

Expected result:
    string(35) "ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS"
  array(8) {
    string(4) ""
    string(1) "N"
    array(3) {
      string(4) "43/1"
      string(4) "16/1"
      string(11) "75363/10000"
    string(1) "E"
    array(3) {
      string(4) "77/1"
      string(4) "21/1"
      string(11) "140249/2629"
    string(1) ""
    string(6) "1603/1"
    string(6) "WGS-84"

these results are taken after fixing image with exiftool: 
# exiftool -all= -tagsfromfile @ -all:all -unsafe 16095163cDU.jpg

Actual result:
Warning: read_exif_data(16095163cDU.jpg): Illegal IFD offset in 
Command line code on line 1
array(4) {
  array(6) {
    string(15) "16095163cDU.jpg"
    string(10) "image/jpeg"
    string(19) "ANY_TAG, IFD0, EXIF"


30Jan2011_50660_exif_c.diff (last revision 2011-01-31 06:30 UTC by mjk at emmjaykay dot org)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-06 12:42 UTC]
If it works with php5.2-201001041530 it means that the issue has been 
 [2010-01-06 12:49 UTC] skinny dot bravo at gmail dot com

- php5.2-201001041530 produces the same result
+ php5.2-201001041530 produces the same result as 5.2.12 below
 [2011-01-31 07:36 UTC] mjk at emmjaykay dot org
The issue stems from exif.c's exif_process_IFD_in_JPEG() function where it calculates NextDirOffset. If this means what I think it does, for EXIF_IFD and IFD_GPS, there is no next IFD and no further parsing should take place. Right now, it parses into the string for the next entry (2009...)

I am not sure if this is correct since I am no expert on EXIF.

The output of var_dump seems to be still in-correct, though. I do not know if this is a separate issue or something I introduced with this patch.
 [2016-08-05 06:13 UTC]

I know this is an old report, could you please reupload the images somewhere? For some reason my ISP have blocked the domain and I do not have a way currently to obtain them from the outside.

 [2016-08-05 06:13 UTC]
-Status: Verified +Status: Feedback -Assigned To: +Assigned To: kalle
 [2016-08-05 18:31 UTC] support at imgsrc dot ru
Can you please try
 [2016-08-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2016-08-14 05:16 UTC]
-Status: No Feedback +Status: Verified
 [2016-10-26 08:14 UTC] mellfotostudio at gmail dot com
This issue exists on PHP version 5.6.27 on Mac OS X via MacPorts. I can vouch for the images coming off directly from the camera. Other programs (Photoshop, Lightroom, Preview) can read EXIF data just fine off the same files.

Warning: read_exif_data(IMG_8456.JPG): IFD data bad offset: 0xFFFFFC72 length 0x1E68 in {php script file}
 [2017-07-07 09:26 UTC]
-Status: Verified +Status: Assigned
 [2017-07-07 09:26 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2017-07-07 09:30 UTC]
Automatic comment on behalf of kalle
Log: Fixed bug #50660 (exif_read_data(): Illegal IFD offset (works fine with other exif readers))
 [2017-07-07 09:30 UTC]
-Status: Assigned +Status: Closed
 [2019-02-12 15:28 UTC] skinny dot bravo at gmail dot com
Still exists in php PHP 7.1.26
 [2019-02-12 15:30 UTC] skinny dot bravo at gmail dot com
-Status: Closed +Status: Assigned -PHP Version: 5.*, 6 +PHP Version: 5.*, 6, 7.1.26
 [2019-02-12 15:30 UTC] skinny dot bravo at gmail dot com
Still exists in php PHP 7.1.26
 [2019-02-12 15:40 UTC]
-Status: Assigned +Status: Closed
 [2019-02-12 15:40 UTC]
PHP 7.1 is no longer actively supported, so this issue cannot be fixed there. Please see for more information on supported PHP versions.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 20:01:29 2024 UTC