Fix issue which occurs when compiling with recent clang releases (>= 14) and with the '-Os' optimisation level, after using `imageloadfont` which returns a proper GdFont class leads to a subtle bug when attempting to use via the imagefont* function. https://github.com/php/php-src/issues/13082 https://github.com/php/php-src/commit/1e464e5b55f81b7fb9476a55f481fe1d2a25d6d9 https://github.com/php/php-src/commit/df85c2556e2217c1bec0fa371f58e20266ffbb28 --- ext/gd/gd.c.orig 2023-12-19 14:35:55.000000000 -0600 +++ ext/gd/gd.c 2024-03-04 02:40:36.000000000 -0600 @@ -2831,8 +2831,8 @@ */ static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) { - zend_object *font_obj; - zend_long font_int; + zend_object *font_obj = NULL; + zend_long font_int = 0; gdFontPtr font; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -2899,9 +2899,8 @@ gdImagePtr im; int ch = 0, col, x, y, i, l = 0; unsigned char *str = NULL; - zend_object *font_obj; - zend_long font_int; - gdFontPtr font; + zend_object *font_obj = NULL; + zend_long font_int = 0; ZEND_PARSE_PARAMETERS_START(6, 6) Z_PARAM_OBJECT_OF_CLASS(IM, gd_image_ce) @@ -2926,7 +2925,7 @@ y = Y; x = X; - font = php_find_gd_font(font_obj, font_int); + gdFontPtr font = php_find_gd_font(font_obj, font_int); switch (mode) { case 0: