Skip to content

Commit 28e7add

Browse files
flaviohelenocmb69
authored andcommitted
Fix #81032: GD install is affected by external libgd installation
This PR replaces the bundled libgd includes from #include <foo.h> with #include "foo.h" for gd-related headers to avoid including headers that may be available in system directories instead of the expected local headers. Closes GH-6975.
1 parent f6c15e2 commit 28e7add

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ PHP NEWS
1818
. Fixed bug #80901 (Info leak in ftp extension). (cmb)
1919
. Fixed bug #79100 (Wrong FTP error messages). (cmb)
2020

21+
- GD:
22+
. Fixed bug #81032 (GD install is affected by external libgd installation).
23+
(Flavio Heleno, cmb)
24+
2125
- MBString:
2226
. Fixed bug #81011 (mb_convert_encoding removes references from arrays). (cmb)
2327

ext/gd/gd.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,23 @@
6060

6161
static int le_gd, le_gd_font;
6262

63-
#include <gd.h>
64-
#include <gd_errors.h>
65-
#include <gdfontt.h> /* 1 Tiny font */
66-
#include <gdfonts.h> /* 2 Small font */
67-
#include <gdfontmb.h> /* 3 Medium bold font */
68-
#include <gdfontl.h> /* 4 Large font */
69-
#include <gdfontg.h> /* 5 Giant font */
63+
#ifdef HAVE_GD_BUNDLED
64+
# include "libgd/gd.h"
65+
# include "libgd/gd_errors.h"
66+
# include "libgd/gdfontt.h" /* 1 Tiny font */
67+
# include "libgd/gdfonts.h" /* 2 Small font */
68+
# include "libgd/gdfontmb.h" /* 3 Medium bold font */
69+
# include "libgd/gdfontl.h" /* 4 Large font */
70+
# include "libgd/gdfontg.h" /* 5 Giant font */
71+
#else
72+
# include <gd.h>
73+
# include <gd_errors.h>
74+
# include <gdfontt.h> /* 1 Tiny font */
75+
# include <gdfonts.h> /* 2 Small font */
76+
# include <gdfontmb.h> /* 3 Medium bold font */
77+
# include <gdfontl.h> /* 4 Large font */
78+
# include <gdfontg.h> /* 5 Giant font */
79+
#endif
7080

7181
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
7282
# include <ft2build.h>

ext/gd/libgd/gd_crop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
* (end code)
2020
**/
2121

22-
#include <gd.h>
2322
#include <stdlib.h>
2423
#include <string.h>
2524
#include <math.h>
2625

26+
#include "gd.h"
27+
2728
static int gdGuessBackgroundColorFromCorners(gdImagePtr im, int *color);
2829
static int gdColorMatch(gdImagePtr im, int col1, int col2, float threshold);
2930

ext/gd/libgd/gd_interpolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#include <string.h>
5959
#include <math.h>
6060

61-
#include <gd.h>
61+
#include "gd.h"
6262
#include "gdhelpers.h"
6363

6464
#ifdef _MSC_VER

ext/gd/libgd/gd_wbmp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
----------------------------------------------------------------------------
5252
*/
5353

54-
#include <gd.h>
55-
#include <gdfonts.h>
56-
#include <gd_errors.h>
5754
#include <stdio.h>
5855
#include <stdlib.h>
5956
#include <limits.h>
6057

58+
#include "gd.h"
59+
#include "gdfonts.h"
60+
#include "gd_errors.h"
6161
#include "wbmp.h"
6262

6363

0 commit comments

Comments
 (0)