-
Notifications
You must be signed in to change notification settings - Fork 7.8k
exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index #9397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What PHP version are you running? (also this is probably more a php-src issue then a doc issue) |
Right. Transferring. |
The problem is that this image has a makernote with an uncommon (non-standard?) format which contains the DJI Info Tags. Since there is no special support for reading this, the reading fails early, and that causes quite some information to be missing from the I have not been able to find some normative information about this format, but the following work-around might be a start: ext/exif/exif.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index a6db8745b3..51545f74cc 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -3170,6 +3170,10 @@ static bool exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * val
dir_start = value_ptr + maker_note->offset;
+ if (!strcmp(maker_note->make, "DJI") && *dir_start == '[') {
+ return true;
+ }
+
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s @x%04X + 0x%04X=%d: %s", exif_get_sectionname(section_index), (intptr_t)dir_start-(intptr_t)info->offset_base+maker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, (intptr_t)dir_start-(intptr_t)info->offset_base+maker_note->offset+displacement));
#endif That would yield:
|
My PHP version is 8.1.0.
Thanks @cmb69, do you think that native php exif read function could be updated ? |
Completely failing to parse other EXIF data after parsing the maker note failed, is a bug, and should be fixed (not sure how; patch above is more like a PoC). Being able to parse DJI info tags is more like a feature request, though. |
Thanks @cmb69 , should I open a feature request ? |
Feel free to open a new ticket. However, someone needs to implement that. :) |
I'm not sure if I'm in the right issue, but I'm seeing the "Illegal IFD size" warning when I call exif_read_data() on https://shallowsky.com/images/annular-eclipse-2012/img_5405.jpg (among other images). It doesn't fail to parse the rest of the exif, it's just an annoying warning cluttering my server logs. exiftool shows the image's EXIF without any complaints. exiftool also doesn't show anything matching "dji", "maker" or "note". I'm not sure what PHP is complaining about or how to fix it since the warning isn't specific. |
@akkana That looks like a different issue (the maker note is Canon). It might be because it's a Canon model specific maker note we don't yet parse, or because of a different reason. Can you please make a new bug report for that? Thank you! |
Done, issue #11020 with a small test case included. Sorry for spamming this issue. |
* PHP-8.1: Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
* PHP-8.2: Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
Hello dear, By trying php 8.2, I still have error : Best |
What patch version are you on? Because just saying PHP 8.2 is not sufficiant. |
8.2.0 sorry... |
Please update to the latest patch version |
Works fine ! Good job ! |
Hello community,
I read that on older php versions exif read function was not working properly on certain images.
I should have been patched with new php versions... But not fully...
On recent DJI images, I have a persistent uncapacity to correctly "read exif data" from image
Image example:

here an example of errors I have:

Please note that with other images, it works like a charm. And not problem for me to extract data.
Here is my code:
`//get the EXIF
$exif = exif_read_data($file, 'IFD0');
echo $exif===false ? "Aucun en-tête de donnés n'a été trouvé.
\n" : "L'image contient des en-têtes
\n";
$exif = exif_read_data($file);
The text was updated successfully, but these errors were encountered: