php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80478 Introduce exif.ignore_warnings INI option
Submitted: 2020-12-03 12:58 UTC Modified: 2021-07-14 12:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: rg at mejoramos dot com Assigned:
Status: Open Package: EXIF related
PHP Version: 7.4.13 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-12-03 12:58 UTC] rg at mejoramos dot com
Description:
------------
I upload image to process with

exif_read_data

with some photos result is:

""" exif_read_data(php80D2.tmp): Process tag(xE6FA=UndefinedTag): Illegal format code 0x2035, suppose BYTE in ... [FILE] + [LINE] """

I see:
https://bugs.php.net/bug.php?id=40073
and others.

Test script:
---------------
	$finfo = finfo_open(FILEINFO_MIME);
	$FT = finfo_file($finfo, $_FILES['img']['tmp_name']);
	finfo_close($finfo);
	if(preg_match('/image/i', $FT)){
		if(preg_match('/jpeg|jpg/i', $FT)){
			$FT = exif_read_data($_FILES['img']['tmp_name']);


just LAST LINE = error


Expected result:
----------------
ARRAY with DATE of creation, width, size, name, etc...

Actual result:
--------------
exif_read_data(php80D2.tmp): Process tag(xE6FA=UndefinedTag): Illegal format code 0x2035, suppose BYTE in ... [FILE] + [LINE]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-03 13:05 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-12-03 13:05 UTC] cmb@php.net
Please provide one of those images for public download from the
Web.
 [2020-12-03 13:26 UTC] rg at mejoramos dot com
hi master cmb

I upload the sexy IMG here:

http://mejoramos.com/bugs/DSC00006.JPG

Regards

xD
 [2020-12-03 16:09 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2020-12-03 16:09 UTC] cmb@php.net
Thanks!  I'll have a look ASAP.
 [2020-12-04 13:18 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2020-12-04 13:18 UTC] cmb@php.net
While I get some warnings regarding undefined tags, I get
otherwise expected output from exit_read_data():
<https://gist.github.com/cmb69/83eddfa74f133cc6fd3848cba54e5772>

Are you sure that you are using PHP 7.4.13, and that the provided
image fails for you?
 [2020-12-04 13:58 UTC] rg at mejoramos dot com
>>> Are you sure that you are using PHP 7.4.13 ?

Master CMB in my FIRST/ORIGINAL post I put:

"""
I can't choice my current version PHP 7.4.5 please look:
https://pasteboard.co/JDn53qo.png
"""

but after of I submit, message disappear.

But more:
same bug/error running PHP 8.0.0

Thanks by you check,
my work is stopped becouse I need process a lot of this images...

Regards
 [2020-12-04 14:10 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug
 [2020-12-04 14:10 UTC] cmb@php.net
> I can't choice my current version PHP 7.4.5 […]

You cannot choose that version, because it makes no sense to.  If
there is a bug in 7.4.5 which is also in 7.4.13, choosing 7.4.13
is fine.  If the bug is already fixed in 7.4.13, there is no need
to report the issue.  I just confirmed that this issue is fixed in
PHP-7.3 and PHP-8.0 as well, so I'm closing as not a bug.

> my work is stopped becouse I need process a lot of this images...

Then consider to update to the latest PHP 7.4.13.
 [2020-12-04 14:21 UTC] rg at mejoramos dot com
Master running PHP 8.0.0
error is the same:

<b>Notice</b>: exif_read_data(php5AD9.tmp): Potentially invalid endianess, trying again with different endianness before imminent failure. in FILE, LINE
 [2020-12-04 14:33 UTC] rg at mejoramos dot com
>>> Then consider to update to the latest PHP 7.4.13

Thanks,
2 minutes back I go to www.php.net and download PHP 7.4.13
now my server over Windows 10 is running PHP 7.4.13
again I run code and result (over PHP 7.4.13) is:

<b>Warning</b>: exif_read_data(php16A6.tmp): Process tag(x0000=UndefinedTag): Illegal format code 0x0000, suppose BYTE in FILE, LINE


Regards
 [2020-12-04 15:11 UTC] requinix@php.net
-Status: Not a bug +Status: Feedback
 [2020-12-04 15:11 UTC] requinix@php.net
@cmb's earlier question for you is still important: despite the warning(s), do you still get a correct return value from exif_read_data? It sounds like you do.
 [2020-12-04 15:54 UTC] rg at mejoramos dot com
@requinix@php.net I was download PHP 7.4.13 and the error is IDENTIC:

<b>Notice</b>:  exif_read_data(phpD7AA.tmp): Potentially invalid endianess, trying again with different endianness before imminent failure. in FILE, LINE

Then my script return EMPTY data.

Identic situation running php-7.4.5
Identic situation running php-8.0.0

Can you test please?, some images is storage in https://mejoramos.com/bugs/PHP_80485/



Thanks
 [2020-12-04 16:03 UTC] cmb@php.net
-Status: Feedback +Status: Open -Assigned To: cmb +Assigned To:
 [2020-12-04 16:03 UTC] cmb@php.net
> Then my script return EMPTY data.

Silence the exif_read_data() call using the @ operator, or disable
your error handler.
 [2020-12-04 16:12 UTC] rg at mejoramos dot com
>>> disable your error handler

The police in company is
"NO HIDDEN ERRORS / PREVENT ERRORS"

>>> Silence the exif_read_data() call using the @ operator
ah!,
then becouse exist this option, my report:
[NO'T is a BUG]

true?
 [2020-12-04 16:21 UTC] nikic@php.net
Right. exif_read_data() is normally used together with error suppression (@), unless you specifically want to debug why some EXIF results are missing or similar. Warnings from this functions are generally harmless, as long as you still get back a result.

Maybe this should be documented though?
 [2020-12-04 16:31 UTC] rg at mejoramos dot com
>>> Right.

Then my participation finish here.

Many thanks by your time team PHP.

Regards, and happy 2021


:-)
 [2020-12-04 16:38 UTC] rtrtrtrtrt at dfdfdfdf dot dfd
> Right. exif_read_data() is normally used together with error suppression

sane code *never* should need error supression
 [2020-12-04 18:03 UTC] cmb@php.net
May make sense to introduce exif.ignore_warnings, similar to
<https://www.php.net/manual/en/image.configuration.php#ini.gd.jpeg-ignore-warning>.
 [2021-07-14 12:56 UTC] cmb@php.net
-Summary: exif_read_data(php80D2.tmp): Process tag(xE6FA=UndefinedTag): Illegal format +Summary: Introduce exif.ignore_warnings INI option -Type: Bug +Type: Feature/Change Request
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 07:01:25 2021 UTC