termux-packages/packages/php/fix-gd-constants.patch
YAKSH BARIYA 8f824094ea
libicu: Bump to 70.1 (#7898)
* libicu: Bump to 70.1

* Revbump for packages dependent on libicu

* samba: Bump to 4.14.9

Samba old version tarball removed from website. Newer 4.15.1 is available but needs some experienced user to test and compile, lets leave it for now and dont block libicu upgrade

* php: Fix builds with libicu 70.1

* php: Fix libgd constants

* nodejs,nodejs-lts: Rebuild after libicu upgrade
2021-11-01 07:57:47 +05:30

54 lines
2.1 KiB
Diff

Source https://github.com/php/php-src/pull/7490
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 287cb2f712f8..880d6dddc7d7 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -88,10 +88,10 @@
#define M_PI 3.14159265358979323846
#endif
-/* workaround typo in system libgd 2.3.0 */
-#if defined(GD_FLIP_HORINZONTAL) && !defined(GD_FLIP_HORIZONTAL)
-#define GD_FLIP_HORIZONTAL GD_FLIP_HORINZONTAL
-#endif
+/* don't used libgd constants, not used, so going to be removed */
+#define PHP_GD_FLIP_HORIZONTAL 1
+#define PHP_GD_FLIP_VERTICAL 2
+#define PHP_GD_FLIP_BOTH 3
#ifdef HAVE_GD_FREETYPE
static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
@@ -400,9 +400,9 @@ PHP_MINIT_FUNCTION(gd)
/* GD2 image format types */
REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", PHP_GD_FLIP_HORIZONTAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", PHP_GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", PHP_GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT);
@@ -3599,15 +3599,15 @@ PHP_FUNCTION(imageflip)
im = php_gd_libgdimageptr_from_zval_p(IM);
switch (mode) {
- case GD_FLIP_VERTICAL:
+ case PHP_GD_FLIP_VERTICAL:
gdImageFlipVertical(im);
break;
- case GD_FLIP_HORIZONTAL:
+ case PHP_GD_FLIP_HORIZONTAL:
gdImageFlipHorizontal(im);
break;
- case GD_FLIP_BOTH:
+ case PHP_GD_FLIP_BOTH:
gdImageFlipBoth(im);
break;