php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21049 Gd support does not match libgd declarations
Submitted: 2002-12-16 11:13 UTC Modified: 2002-12-16 12:52 UTC
From: wildfyr9 at hotmail dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 4.2.3 OS: Cobalt Linux
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wildfyr9 at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-12-16 11:13 UTC] wildfyr9 at hotmail dot com
In PHP 4.2.3 (and some previous versions) the ext/gd/* files do not match older libgd installations (such as the 1.2 version that ships on RaQ4 servers. In particular, it includes a 'static' declaration of gdImageColorResolve when it should be 'extern' (see http://i4net.tv/marticle/get.php?action=getarticle&articleid=20 for another report of this bug) and it re-defined (incompatibly) the gdIOCtx object.

To make the compile work I had to modify both php_gd.h and gd.c:

*** ext/gd/php_gd.h.4.2.3       Mon Dec 16 18:02:43 2002
--- ext/gd/php_gd.h     Mon Dec 16 18:03:41 2002
***************
*** 66,72 ****
  PHP_MSHUTDOWN_FUNCTION(gd);

  #ifndef HAVE_GDIMAGECOLORRESOLVE
! static int gdImageColorResolve(gdImagePtr, int, int, int);
  #endif
  PHP_FUNCTION(imagearc);
  PHP_FUNCTION(imagechar);
--- 66,72 ----
  PHP_MSHUTDOWN_FUNCTION(gd);

  #ifndef HAVE_GDIMAGECOLORRESOLVE
! extern int gdImageColorResolve(gdImagePtr, int, int, int);
  #endif
  PHP_FUNCTION(imagearc);
  PHP_FUNCTION(imagechar);
*** ext/gd/php_gd.h.4.2.3       Mon Dec 16 18:02:43 2002
--- ext/gd/php_gd.h     Mon Dec 16 18:03:41 2002
***************
*** 66,72 ****
  PHP_MSHUTDOWN_FUNCTION(gd);

  #ifndef HAVE_GDIMAGECOLORRESOLVE
! static int gdImageColorResolve(gdImagePtr, int, int, int);
  #endif
  PHP_FUNCTION(imagearc);
  PHP_FUNCTION(imagechar);
--- 66,72 ----
  PHP_MSHUTDOWN_FUNCTION(gd);

  #ifndef HAVE_GDIMAGECOLORRESOLVE
! extern int gdImageColorResolve(gdImagePtr, int, int, int);
  #endif
  PHP_FUNCTION(imagearc);
  PHP_FUNCTION(imagechar);
 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-16 11:21 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

If you must use GD 1.X use 1.8.4, PHP 4.3.0 already comes with  bundled GD library that has been tested & works properly.
 [2002-12-16 11:41 UTC] wildfyr9 at hotmail dot com
I guess I'm not sure why this is not a bug? It doesn't compile without making modifications to the distributed code. In our world we call that a bug. 

Anyway, I have read the docs. I am using 4.2.3 (not 4.3.0 because that's in pre-release and these are productions servers) which AFAIK does NOT include a 'bundled gd library.' Updating libgd on these servers to 1.8.4 would be a good idea, but that would require rebuilding a lot of other software on the server. Not something I can do right now.

In any case, there is nothing in the docs that I could find that said I should use gd 1.8.4. At http://www.php.net/manual/en/install.configure.php#install.configure.options.graphics it says:

--with-gd[=DIR]
Include GD support (DIR is GD's install dir). Set DIR to shared to build as a dl, or shared,DIR to build as a dl and still specify DIR. 

(Which, BTW, took three readings for me to be able to understand.) This does not even SUGGEST that PHP will build it's own gd. It says that you should specify the install directory.

Finally, if these simple fixes allow PHP to work with older versions of libgd, why not add them to the code base to support it?
 [2002-12-16 12:52 UTC] iliaa@php.net
Few reasons why this is bogus in addition to the original comments. In 4.3.0 the gdImageColorResolve() is already defined as extern and not static. The documentation unfortunately does not reflect the latest situation with libgd & PHP, in 4.3.0 if you use the --with-gd option, it will result in your PHP being compiled against bundled GD library that is roughly equivalent to GD 2.0.6. Only if you use --with-gd & specify a path to the system library will it use the non-bundled lib.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 10:01:30 2024 UTC