php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #19210 read_exif_data truncates JPEG comments to 198 characters
Submitted: 2002-09-03 12:05 UTC Modified: 2002-09-21 17:30 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: roland at astrofoto dot org Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.2 OS: RedHat 7.2/Linux 2.4.9
Private report: No CVE-ID: None
 [2002-09-03 12:05 UTC] roland at astrofoto dot org
I have a JPEG (*not* from a digital camera) to which I have added a comment block using wrjpegcom.  rdjepgcom confirms that the comment is correct in the file.  The length of the comment is about 345 characters.

When I read the comment back from PHP using read_exif_data, the length is truncated at 198 characters.  Note that JPEG comment blocks can be up to 64k(!).  The comment in question is all text, no ASCII nulls, so I'm assuming this truncation is happening inside PHP.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-03 12:12 UTC] roland at astrofoto dot org
I should have posted a small test sample.  I'm putting one up on my web site at http://www.astrofoto.org/people/roland/bug.php.  The image being probed can be loaded from the URL http://www.astrofoto.org/people/roland/20020716-1.05.jpg
 [2002-09-03 13:15 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-09-03 14:24 UTC] roland at astrofoto dot org
This is apparently resolved in 4.2.2.  However, the layout of the return array from read_exif_data has significantly changed, so I'm going to have to rewrite my code.  In particular, there is no array element named 'Comments' which was present in 4.1.2 (and I can find no mention of this change in the ChangeLog or a footnote in the current online documentation).

In fact, the additional parameters do not even work in PHP < 4.2.  So you have to code

$exif = @read_exif_data ($image, 0, true);
if (!isset($exif) || empty($exif)) {
   // Fall back to PHP 4.1 read_exif_data()
   $exif = read_exif_data ($image);
   ...
}

Someplace, a footnote to this effect would be nice.  Should I open a documentation bug?
 [2002-09-03 15:47 UTC] sniper@php.net
reclassified..

 [2002-09-21 17:30 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Aug 14 05:01:30 2024 UTC