php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20258 gd 2.0.3 gdIOCtx renames 'free' member to 'gd_free', this breaks PHP builds
Submitted: 2002-11-05 09:03 UTC Modified: 2002-11-05 09:06 UTC
From: boutell at boutell dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.2.3 OS: Anything with gd 2.0.3 or later
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: boutell at boutell dot com
New email:
PHP Version: OS:

 

 [2002-11-05 09:03 UTC] boutell at boutell dot com
First let me acknowledge that "bug" is not the right
word for this. No criticism is intended.

Now, here's the situation:

I am the author of the gd library 
(http://www.boutell.com/gd/). PHP uses this library to
generate images. gd 2.0.x has recently been revived,
debugged and promoted as the latest and greatest,
truecolor-capable version, and PHP supports this.
Hurrah. Except...

In gd 2.0.3, a contributor changed the name of the
'free' member of the gdIOCtx structure (in gd_io.h),
with the very best of intentions: he wanted to improve
compatibility with macro-based memory leak detectors,
which were easily confused by a structure member
called 'free'. I did not immediately realize, when
I accepted the patch, that of course it would break
PHP and other code that uses custom gdIOCtx structures.

In gd 2.0.3 and above, the 'free' member of this
structure has been renamed 'gd_free'. By now, this
change is already reflected in GD.pm (for Perl) and
other code, making it hard to back out at this point.
Otherwise, I'd gladly make the change in gd instead.

The corresponding fix to PHP is absolutely trivial and 
straightforward, of course, and I hope that it can be 
quickly included in the next patch of PHP 4.2.x and
4.3.x. 

(Technically, I *have* made the change in gd, but the 
solution there is not optimal and fixing the structure name 
in PHP code makes much more sense: in the forthcoming gd 
2.0.5, there's a way to set a #define that would change the 
member name from gd_free to something else, but this is 
only useful if gd will be used ONLY with the code that 
expects to see something else, and therefore not useful for 
building a pretty shared library of gd, which we all want 
to see. And setting that macro constitutes something new to 
do in PHP; if that's going to happen it makes much more 
sense to just fix the occurrences of .free to .gd_free and 
be done with it!)

My apologies for the annoyance, and I hope we can get this 
fixed soon and make the PHP people who are sending me sad 
"it won't build!" emails about gd 2.0.x happy.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-05 09:06 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-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 14:01:31 2025 UTC