Skip to content

ext/gd: return void for couple of calls returning true when success is #18651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ PHP 8.5 UPGRADE NOTES
5. Changed Functions
========================================

- GD:
. imagethickness, imagefilledeclipse, imagefilledarc, imagealphablending,
imagesavealpha, imagelayereffect, imagecopyresampled, imagesetpixel,
imageline, imagedashedline, imagerectangle, imagefilledrectangle,
imagearc, imageellipse, imagefill, imagechar*, iamgestring*,
imagecopy, imagecopymerge, imagecopymergegray, imagecopyresized,
imagesetclip, imgeflip and imageantialias no return true.

- Intl:
. IntlDateFormatter::setTimeZone()/datefmt_set_timezone()
throws an IntlException on uninitialised classes/clone failures.
Expand Down
32 changes: 0 additions & 32 deletions ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,6 @@ PHP_FUNCTION(imagesetthickness)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageSetThickness(im, thick);

RETURN_TRUE;
}
/* }}} */

Expand All @@ -833,7 +831,6 @@ PHP_FUNCTION(imagefilledellipse)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageFilledEllipse(im, cx, cy, w, h, color);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -870,8 +867,6 @@ PHP_FUNCTION(imagefilledarc)
}

gdImageFilledArc(im, cx, cy, w, h, st, e, col, style);

RETURN_TRUE;
}
/* }}} */

Expand All @@ -890,8 +885,6 @@ PHP_FUNCTION(imagealphablending)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageAlphaBlending(im, blend);

RETURN_TRUE;
}
/* }}} */

Expand All @@ -910,8 +903,6 @@ PHP_FUNCTION(imagesavealpha)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageSaveAlpha(im, save);

RETURN_TRUE;
}
/* }}} */

Expand All @@ -930,8 +921,6 @@ PHP_FUNCTION(imagelayereffect)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageAlphaBlending(im, effect);

RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -1084,8 +1073,6 @@ PHP_FUNCTION(imagecopyresampled)
dstW = DW;

gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);

RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -2522,7 +2509,6 @@ PHP_FUNCTION(imagesetpixel)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageSetPixel(im, x, y, col);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -2550,7 +2536,6 @@ PHP_FUNCTION(imageline)
col = gdAntiAliased;
}
gdImageLine(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2573,7 +2558,6 @@ PHP_FUNCTION(imagedashedline)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageDashedLine(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2596,7 +2580,6 @@ PHP_FUNCTION(imagerectangle)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2618,7 +2601,6 @@ PHP_FUNCTION(imagefilledrectangle)

im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -2654,7 +2636,6 @@ PHP_FUNCTION(imagearc)
}

gdImageArc(im, cx, cy, w, h, st, e, col);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2677,7 +2658,6 @@ PHP_FUNCTION(imageellipse)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageEllipse(im, cx, cy, w, h, color);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2699,7 +2679,6 @@ PHP_FUNCTION(imagefilltoborder)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageFillToBorder(im, x, y, border, col);
RETURN_TRUE;
}
/* }}} */

Expand All @@ -2720,7 +2699,6 @@ PHP_FUNCTION(imagefill)
im = php_gd_libgdimageptr_from_zval_p(IM);

gdImageFill(im, x, y, col);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3038,7 +3016,6 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
if (str) {
efree(str);
}
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3100,7 +3077,6 @@ PHP_FUNCTION(imagecopy)
dstY = DY;

gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3136,7 +3112,6 @@ PHP_FUNCTION(imagecopymerge)
pct = PCT;

gdImageCopyMerge(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3172,7 +3147,6 @@ PHP_FUNCTION(imagecopymergegray)
pct = PCT;

gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3230,7 +3204,6 @@ PHP_FUNCTION(imagecopyresized)
}

gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3284,7 +3257,6 @@ PHP_FUNCTION(imagesetclip)
im = php_gd_libgdimageptr_from_zval_p(im_zval);

gdImageSetClip(im, x1, y1, x2, y2);
RETURN_TRUE;
}
/* }}} */

Expand Down Expand Up @@ -3744,8 +3716,6 @@ PHP_FUNCTION(imageflip)
zend_argument_value_error(2, "must be one of IMG_FLIP_VERTICAL, IMG_FLIP_HORIZONTAL, or IMG_FLIP_BOTH");
RETURN_THROWS();
}

RETURN_TRUE;
}
/* }}} */

Expand All @@ -3765,8 +3735,6 @@ PHP_FUNCTION(imageantialias)
if (im->trueColor) {
im->AA = alias;
}

RETURN_TRUE;
}
/* }}} */

Expand Down
54 changes: 27 additions & 27 deletions ext/gd/gd.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,17 +498,17 @@ function imagepalettetotruecolor(GdImage $image): bool {}

function imagecolormatch(GdImage $image1, GdImage $image2): true {}

function imagesetthickness(GdImage $image, int $thickness): true {}
function imagesetthickness(GdImage $image, int $thickness): void {}

function imagefilledellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): true {}
function imagefilledellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): void {}

function imagefilledarc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color, int $style): true {}
function imagefilledarc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color, int $style): void {}

function imagealphablending(GdImage $image, bool $enable): true {}
function imagealphablending(GdImage $image, bool $enable): void {}

function imagesavealpha(GdImage $image, bool $enable): true {}
function imagesavealpha(GdImage $image, bool $enable): void {}

function imagelayereffect(GdImage $image, int $effect): true {}
function imagelayereffect(GdImage $image, int $effect): void {}

function imagecolorallocatealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}

Expand All @@ -518,7 +518,7 @@ function imagecolorclosestalpha(GdImage $image, int $red, int $green, int $blue,

function imagecolorexactalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}

function imagecopyresampled(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): true {}
function imagecopyresampled(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): void {}

#ifdef PHP_WIN32

Expand Down Expand Up @@ -663,23 +663,23 @@ function imagecolorsforindex(GdImage $image, int $color): array {}

function imagegammacorrect(GdImage $image, float $input_gamma, float $output_gamma): true {}

function imagesetpixel(GdImage $image, int $x, int $y, int $color): true {}
function imagesetpixel(GdImage $image, int $x, int $y, int $color): void {}

function imageline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): true {}
function imageline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void {}

function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): true {}
function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void {}

function imagerectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): true {}
function imagerectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void {}

function imagefilledrectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): true {}
function imagefilledrectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): void {}

function imagearc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color): true {}
function imagearc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color): void {}

function imageellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): true {}
function imageellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): void {}

function imagefilltoborder(GdImage $image, int $x, int $y, int $border_color, int $color): true {}
function imagefilltoborder(GdImage $image, int $x, int $y, int $border_color, int $color): void {}

function imagefill(GdImage $image, int $x, int $y, int $color): true {}
function imagefill(GdImage $image, int $x, int $y, int $color): void {}

function imagecolorstotal(GdImage $image): int {}

Expand All @@ -697,27 +697,27 @@ function imagefontwidth(GdFont|int $font): int {}

function imagefontheight(GdFont|int $font): int {}

function imagechar(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): true {}
function imagechar(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): void {}

function imagecharup(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): true {}
function imagecharup(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): void {}

function imagestring(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): true {}
function imagestring(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): void {}

function imagestringup(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): true {}
function imagestringup(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): void {}

function imagecopy(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height): true {}
function imagecopy(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height): void {}

function imagecopymerge(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): true {}
function imagecopymerge(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): void {}

function imagecopymergegray(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): true {}
function imagecopymergegray(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): void {}

function imagecopyresized(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): true {}
function imagecopyresized(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): void {}

function imagesx(GdImage $image): int {}

function imagesy(GdImage $image): int {}

function imagesetclip(GdImage $image, int $x1, int $y1, int $x2, int $y2): true {}
function imagesetclip(GdImage $image, int $x1, int $y1, int $x2, int $y2): void {}

/**
* @return array<int, int>
Expand Down Expand Up @@ -756,9 +756,9 @@ function imagefilter(GdImage $image, int $filter, ...$args): bool {}

function imageconvolution(GdImage $image, array $matrix, float $divisor, float $offset): bool {}

function imageflip(GdImage $image, int $mode): true {}
function imageflip(GdImage $image, int $mode): void {}

function imageantialias(GdImage $image, bool $enable): true {}
function imageantialias(GdImage $image, bool $enable): void {}

/** @refcount 1 */
function imagecrop(GdImage $image, array $rectangle): GdImage|false {}
Expand Down
Loading