|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66519 All EXIF related functions randomly return error
Submitted: 2014-01-20 10:20 UTC Modified: 2016-02-14 04:22 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: staviq at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: EXIF related
PHP Version: 5.5.8 OS: Windows 2012
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: staviq at gmail dot com
New email:
PHP Version: OS:


 [2014-01-20 10:20 UTC] staviq at gmail dot com
All EXIF related function randomly out of nowhere return:

Warning: exif_thumbnail(***FILENAME***): File too small (0) in ***SCRIPTNAME*** on line XXX

Sometimes function like "exif_thumbnail", or "exif_read_data" will give me expected result, like a tumbnail or array of properties, but most of the time ( about 90% ) it will give me mentioned error.

Tried on php 5.5.6 ( XAMPP bundled ) and 5.5.8 ( downloaded from, used with nginx )

Test script:
$i = "***FILENAME***";
$image = exif_thumbnail($i, $width, $height, $type);
if( max( $width, $height ) == $width )
	$w = 256;
	$h = 256*( $height/$width );
	$h = 256;
	$w = 256*( $height/$width );
echo "<img style=\"width: ".$w."px; height: ".$h."px;\" src='data:image/jpeg;base64,".base64_encode($image)."'>";

Expected result:
Consistent result, either error every time, or expected thumbnail every time.

Actual result:
Warning: exif_thumbnail(P1030005.JPG): File too small (0) in E:\xampp\htdocs\t3.php on line 3

Warning: Division by zero in E:\xampp\htdocs\t3.php on line 7


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-20 10:27 UTC] staviq at gmail dot com

Inconsistent results are given for the same file, i might add.
 [2014-01-20 10:36 UTC] staviq at gmail dot com

It got event stranger, if i call this script from CLI results are CORRECT most of the time, but if the same script is called from apache ( as http request ) result is most of the time INCORRECT.
 [2016-02-04 16:53 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-02-04 16:53 UTC]
Do you still experience this issue with recent PHP versions? If
so, please make sure that the file really does exist and is
readable, i.e.

$i = "***FILENAME***";
var_dump(is_readable($i)); // add this line
$image = exif_thumbnail($i, $width, $height, $type);
// …

If the function still fails randomly, we'd need a sample image
file to be able to reproduce the issue.
 [2016-02-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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 09:03:42 2022 UTC