php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49595 Incorrect example code
Submitted: 2009-09-18 22:40 UTC Modified: 2009-09-20 08:50 UTC
From: nilesprague at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nilesprague at gmail dot com
New email:
PHP Version: OS:

 

 [2009-09-18 22:40 UTC] nilesprague at gmail dot com
Description:
------------
Two problems with the example code on the documentation page, and as a result, the code does not work:

1) The code is incomplete.  The $content variable must be written to the image file to apply the changes - that is, to write the iptc data to the image file.  The following code must be added at the end of the example:

$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);

2) The $tag variable is being "substr" twice, but this should only be done once.

The existing code is this:

    $tag = substr($tag, 2);
    $data .= iptc_make_tag(2, substr($tag, 2), $string);

And should be changed to this: 

    $data .= iptc_make_tag(2, substr($tag, 2), $string);

Reproduce code:
---------------
---
From manual page: function.iptcembed
---



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-20 08:50 UTC] svn@php.net
Automatic comment from SVN on behalf of torben
Revision: http://svn.php.net/viewvc/?view=revision&revision=288470
Log: Allow the example for iptcembed to write its result to the original
.jpg file.
Addresses bug #49595.
 [2009-09-20 08:50 UTC] torben@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 13:00:02 2026 UTC