diff --git a/ext/gd/gd.c b/ext/gd/gd.c index bbe159f4d60..10e52702952 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -34,6 +34,7 @@ #include "ext/standard/info.h" #include "php_open_temporary_file.h" #include "php_memory_streams.h" +#include "zend_attributes.h" #include "zend_object_handlers.h" #ifdef HAVE_SYS_WAIT_H diff --git a/ext/gd/gd.stub.php b/ext/gd/gd.stub.php index d63c5ea7725..277dd7afeba 100644 --- a/ext/gd/gd.stub.php +++ b/ext/gd/gd.stub.php @@ -629,6 +629,7 @@ function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = 128, i /** @param resource|string|null $file */ function imagebmp(GdImage $image, $file = null, bool $compressed = true): bool {} +#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")] function imagedestroy(GdImage $image): true {} function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {} diff --git a/ext/gd/gd_arginfo.h b/ext/gd/gd_arginfo.h index d46c9f06f6e..3332fb70bbc 100644 --- a/ext/gd/gd_arginfo.h +++ b/ext/gd/gd_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3db75a07cd5dfda50f239bc8c3992cd6d1e7afcb */ + * Stub hash: bbf4c8d4a3ee5712120bd89f4a2ecc516ea65ff1 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -759,7 +759,7 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(imagegd, arginfo_imagegd) ZEND_FE(imagegd2, arginfo_imagegd2) ZEND_FE(imagebmp, arginfo_imagebmp) - ZEND_FE(imagedestroy, arginfo_imagedestroy) + ZEND_RAW_FENTRY("imagedestroy", zif_imagedestroy, arginfo_imagedestroy, ZEND_ACC_DEPRECATED, NULL, NULL) ZEND_FE(imagecolorallocate, arginfo_imagecolorallocate) ZEND_FE(imagepalettecopy, arginfo_imagepalettecopy) ZEND_FE(imagecolorat, arginfo_imagecolorat) @@ -923,6 +923,14 @@ static void register_gd_symbols(int module_number) REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x8 | 0x10 | 0x20 | 0x40 | 0x80, CONST_PERSISTENT); #endif + + + zend_attribute *attribute_Deprecated_func_imagedestroy_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "imagedestroy", sizeof("imagedestroy") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + ZVAL_STR(&attribute_Deprecated_func_imagedestroy_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5)); + attribute_Deprecated_func_imagedestroy_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zend_string *attribute_Deprecated_func_imagedestroy_0_arg1_str = zend_string_init("as it has no effect since PHP 8.0", strlen("as it has no effect since PHP 8.0"), 1); + ZVAL_STR(&attribute_Deprecated_func_imagedestroy_0->args[1].value, attribute_Deprecated_func_imagedestroy_0_arg1_str); + attribute_Deprecated_func_imagedestroy_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); } static zend_class_entry *register_class_GdImage(void) diff --git a/ext/gd/tests/bug19366.phpt b/ext/gd/tests/bug19366.phpt index 7fae0be5d7e..93288dc96ad 100644 --- a/ext/gd/tests/bug19366.phpt +++ b/ext/gd/tests/bug19366.phpt @@ -36,8 +36,6 @@ echo "Alive: Send to browser\n"; //Header("Content-type: image/PNG"); //ImagePNG($ImHandle); -echo "Alive: Free resources\n"; -imagedestroy($ImHandle); echo "Alive: Done\n"; ?> --EXPECT-- @@ -46,5 +44,4 @@ Alive: Define colors Alive: Draw Alive: ImageString Alive: Send to browser -Alive: Free resources Alive: Done diff --git a/ext/gd/tests/bug28147.phpt b/ext/gd/tests/bug28147.phpt index 90314b15322..0578f659bd9 100644 --- a/ext/gd/tests/bug28147.phpt +++ b/ext/gd/tests/bug28147.phpt @@ -16,8 +16,6 @@ imagefilledrectangle($im,0,0,299,299,$w); imageantialias($im,true); imageline($im, 299, 299, 0, 299, $red); -imagedestroy($im); - echo "Alive\n"; ?> --EXPECT-- diff --git a/ext/gd/tests/bug36697-mb.phpt b/ext/gd/tests/bug36697-mb.phpt index 0a661012bcb..f061076da72 100644 --- a/ext/gd/tests/bug36697-mb.phpt +++ b/ext/gd/tests/bug36697-mb.phpt @@ -13,7 +13,7 @@ imagecolortransparent($im, $trans_color); imagefilledrectangle($im, 0,0, 192,36, $trans_color); $c = imagecolorat($im, 191,35); imagegif($im, $dest); -imagedestroy($im); +$im = null; $im = imagecreatefromgif($dest); $c = imagecolorat($im, 191, 35); $colors = imagecolorsforindex($im, $c); diff --git a/ext/gd/tests/bug36697.phpt b/ext/gd/tests/bug36697.phpt index ae6cc5bc64d..838750ccf25 100644 --- a/ext/gd/tests/bug36697.phpt +++ b/ext/gd/tests/bug36697.phpt @@ -13,7 +13,7 @@ imagecolortransparent($im, $trans_color); imagefilledrectangle($im, 0,0, 192,36, $trans_color); $c = imagecolorat($im, 191,35); imagegif($im, $dest); -imagedestroy($im); +$im = null; $im = imagecreatefromgif($dest); $c = imagecolorat($im, 191, 35); $colors = imagecolorsforindex($im, $c); diff --git a/ext/gd/tests/bug38179.phpt b/ext/gd/tests/bug38179.phpt index 17e9ed28406..1dee6687677 100644 --- a/ext/gd/tests/bug38179.phpt +++ b/ext/gd/tests/bug38179.phpt @@ -18,8 +18,6 @@ imagecopy($dst_tc, $src, 0,0, 0,0, imagesx($src), imagesy($src)); $p1 = imagecolorat($dst_tc, 3,3); printf("%X\n", $p1); - -imagedestroy($src); imagedestroy($dst_tc); ?> --EXPECT-- 46FF0000 diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt index d7cca5ab6b3..ddc6c8000d6 100644 --- a/ext/gd/tests/bug42434.phpt +++ b/ext/gd/tests/bug42434.phpt @@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) { } else { echo 'Bugged'; } - -imagedestroy($im); ?> --EXPECT-- DONE diff --git a/ext/gd/tests/bug43121.phpt b/ext/gd/tests/bug43121.phpt index 21550a03c88..81eb564a5e6 100644 --- a/ext/gd/tests/bug43121.phpt +++ b/ext/gd/tests/bug43121.phpt @@ -17,8 +17,6 @@ $im_tile = ImageCreateFromGif(__DIR__ . "/bug43121.gif" ); ImageSetTile( $im, $im_tile ); ImageFill( $im, 0, 0, IMG_COLOR_TILED ); -ImageDestroy( $im ); - print "OK"; ?> --EXPECT-- diff --git a/ext/gd/tests/bug43828.phpt b/ext/gd/tests/bug43828.phpt index 8bc3f9bbcaf..fd6620666f8 100644 --- a/ext/gd/tests/bug43828.phpt +++ b/ext/gd/tests/bug43828.phpt @@ -23,8 +23,6 @@ imagefilledarc($im, 49, 49, 99,99, 0 , 360, $color, IMG_ARC_PIE); include_once __DIR__ . '/func.inc'; test_image_equals_file(__DIR__ . '/bug43828.png', $im); - -imagedestroy($im); ?> --EXPECT-- The images are equal. diff --git a/ext/gd/tests/bug45799.phpt b/ext/gd/tests/bug45799.phpt index f7124ce5b97..dc20efdbb94 100644 --- a/ext/gd/tests/bug45799.phpt +++ b/ext/gd/tests/bug45799.phpt @@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) { --EXPECTF-- Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d diff --git a/ext/gd/tests/bug50194.phpt b/ext/gd/tests/bug50194.phpt index 33d2400c46e..860ac3d5053 100644 --- a/ext/gd/tests/bug50194.phpt +++ b/ext/gd/tests/bug50194.phpt @@ -32,8 +32,6 @@ if (isset($matches[1]) && $matches[1] > 2000) { } else { echo "The images are similar.\n"; } - -imagedestroy($im); ?> --EXPECT-- The images are similar. diff --git a/ext/gd/tests/bug61221.phpt b/ext/gd/tests/bug61221.phpt index 97a90db045b..fa2d89cff34 100644 --- a/ext/gd/tests/bug61221.phpt +++ b/ext/gd/tests/bug61221.phpt @@ -15,7 +15,6 @@ imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid); imagegammacorrect($img, 1, 1); $color = imagecolorat($img, 0, 0); var_dump($color === $blacktransparent); -imagedestroy($img); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/bug65148.phpt b/ext/gd/tests/bug65148.phpt index 4dfa13ccaa9..0d71655aad1 100644 --- a/ext/gd/tests/bug65148.phpt +++ b/ext/gd/tests/bug65148.phpt @@ -37,10 +37,8 @@ foreach ($interpolations as $name => $interpolation) { $t = imagecolorallocatealpha($img, 0, 0, 0, 127); $imgr = imagerotate($img, -5, $t); $results[$name] = array('x' => imagesx($imgr), 'y' => imagesy($imgr)); - imagedestroy($imgr); } -imagedestroy($img); print_r($results); ?> --EXPECT-- diff --git a/ext/gd/tests/bug67325.phpt b/ext/gd/tests/bug67325.phpt index b1e84242a4a..fe5602567f8 100644 --- a/ext/gd/tests/bug67325.phpt +++ b/ext/gd/tests/bug67325.phpt @@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) { } } var_dump($white); - -imagedestroy($im); ?> --EXPECT-- int(0) diff --git a/ext/gd/tests/bug67447.phpt b/ext/gd/tests/bug67447.phpt index e78e272ff2e..f8e4d20c794 100644 --- a/ext/gd/tests/bug67447.phpt +++ b/ext/gd/tests/bug67447.phpt @@ -10,8 +10,6 @@ $red = imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $red); $cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]); var_dump(imagecolorat($cropped, 249, 249) === $red); -imagedestroy($image); -imagedestroy($cropped); // palette $image = imagecreate(500, 500); @@ -20,8 +18,6 @@ $red = imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $red); $cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]); var_dump(imagecolorsforindex($cropped, imagecolorat($cropped, 249, 249))); -imagedestroy($image); -imagedestroy($cropped); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/bug69024.phpt b/ext/gd/tests/bug69024.phpt index da80a5b609a..d6eaa40a31f 100644 --- a/ext/gd/tests/bug69024.phpt +++ b/ext/gd/tests/bug69024.phpt @@ -6,7 +6,6 @@ gd --EXPECT-- diff --git a/ext/gd/tests/bug70102.phpt b/ext/gd/tests/bug70102.phpt index bfdcbd377a3..63a81f7cc46 100644 --- a/ext/gd/tests/bug70102.phpt +++ b/ext/gd/tests/bug70102.phpt @@ -19,7 +19,6 @@ $white = imagecolorallocate($im, 255, 255, 255); var_dump($white & 0xffffff); imagefilledrectangle($im, 0, 0, 7, 7, $white); imagewebp($im, $filename); -imagedestroy($im); $im = imagecreatefromwebp($filename); $color = imagecolorat($im, 4, 4); diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index 561a1b347b5..c6c30c50207 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -33,9 +33,6 @@ fclose($fh); $im = imagecreatefromgd2($fname); -if ($im) { - imagedestroy($im); -} unlink($fname); ?> diff --git a/ext/gd/tests/bug72709.phpt b/ext/gd/tests/bug72709.phpt index b0b4aa77bdf..bc20d1bf58b 100644 --- a/ext/gd/tests/bug72709.phpt +++ b/ext/gd/tests/bug72709.phpt @@ -14,7 +14,6 @@ catch (\Error $ex) { } imagesetpixel($im, 0, 0, IMG_COLOR_STYLED); -imagedestroy($im); ?> ====DONE==== --EXPECT-- diff --git a/ext/gd/tests/bug77198_auto.phpt b/ext/gd/tests/bug77198_auto.phpt index 9df67d7f2ff..5153ec4870a 100644 --- a/ext/gd/tests/bug77198_auto.phpt +++ b/ext/gd/tests/bug77198_auto.phpt @@ -39,9 +39,7 @@ for ($y = 0; $y < 8; $y++) { if ($color !== 0x000000) { printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color); } - imagedestroy($cropped); } - imagedestroy($orig); } } diff --git a/ext/gd/tests/bug77198_threshold.phpt b/ext/gd/tests/bug77198_threshold.phpt index e164286afca..662ebbe75c0 100644 --- a/ext/gd/tests/bug77198_threshold.phpt +++ b/ext/gd/tests/bug77198_threshold.phpt @@ -36,9 +36,7 @@ for ($y = 0; $y < 8; $y++) { if ($color !== 0x000000) { printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color); } - imagedestroy($cropped); } - imagedestroy($orig); } } diff --git a/ext/gd/tests/colorat.phpt b/ext/gd/tests/colorat.phpt index d0e62aca910..82d6d56b5c7 100644 --- a/ext/gd/tests/colorat.phpt +++ b/ext/gd/tests/colorat.phpt @@ -15,7 +15,6 @@ echo 'test colorat truecolor: '; $c = imagecolorat($im, 3,3); echo $c == 0x0 ? 'ok' : 'failed'; echo "\n"; -imagedestroy($im); $im = imagecreate(6,6); $c1 = imagecolorallocate($im, 255,255,255); diff --git a/ext/gd/tests/colorclosest.phpt b/ext/gd/tests/colorclosest.phpt index 2633b24017d..8cfcbdcdea4 100644 --- a/ext/gd/tests/colorclosest.phpt +++ b/ext/gd/tests/colorclosest.phpt @@ -8,7 +8,7 @@ gd $im = imagecreatetruecolor(5,5); $c = imagecolorclosest($im, 255,0,255); printf("%X\n", $c); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); $c = imagecolorclosest($im, 255,0,255); @@ -17,13 +17,13 @@ try { } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } -imagedestroy($im); +$im = null; $im = imagecreate(5,5); imagecolorallocate($im, 255, 0, 255); $c = imagecolorclosest($im, 255,0,255); print_r(imagecolorsforindex($im, $c)); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0); @@ -46,7 +46,7 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreatetruecolor(5,5); $c = imagecolorclosestalpha($im, 255,0,255,100); printf("%X\n", $c); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); $c = imagecolorclosestalpha($im, 255,0,255,100); @@ -55,13 +55,13 @@ try { } catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } -imagedestroy($im); +$im = null; $im = imagecreate(5,5); imagecolorallocatealpha($im, 255, 0, 255, 1); $c = imagecolorclosestalpha($im, 255,0,255,1); print_r(imagecolorsforindex($im, $c)); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); diff --git a/ext/gd/tests/colorexact.phpt b/ext/gd/tests/colorexact.phpt index 361701c77d3..c28ad54d501 100644 --- a/ext/gd/tests/colorexact.phpt +++ b/ext/gd/tests/colorexact.phpt @@ -12,7 +12,7 @@ $c2 = imagecolorexactalpha($im, 255,0,255, 100); printf("%X\n", $c); printf("%X\n", $c2); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); $c = imagecolorallocate($im, 255,0,255); @@ -26,8 +26,6 @@ echo imagecolorexactalpha($im, 255,200,0,100) . "\n"; // unallocated index echo imagecolorexact($im, 12,12,12) . "\n"; - -imagedestroy($im); ?> --EXPECT-- FF00FF diff --git a/ext/gd/tests/colormatch.phpt b/ext/gd/tests/colormatch.phpt index 65b690ecd01..fe22784c994 100644 --- a/ext/gd/tests/colormatch.phpt +++ b/ext/gd/tests/colormatch.phpt @@ -15,8 +15,6 @@ try { } echo "ok\n"; - -imagedestroy($im); ?> --EXPECT-- imagecolormatch(): Argument #2 ($image2) must have at least one color diff --git a/ext/gd/tests/colorresolve.phpt b/ext/gd/tests/colorresolve.phpt index 08daa4bb5f0..595018e73dc 100644 --- a/ext/gd/tests/colorresolve.phpt +++ b/ext/gd/tests/colorresolve.phpt @@ -8,12 +8,12 @@ gd $im = imagecreatetruecolor(5,5); $c = imagecolorresolve($im, 255,0,255); printf("%X\n", $c); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); $c = imagecolorresolve($im, 255,0,255); print_r(imagecolorsforindex($im, $c)); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0); @@ -38,12 +38,12 @@ print_r(imagecolorsforindex($im, $c)); $im = imagecreatetruecolor(5,5); $c = imagecolorresolvealpha($im, 255,0,255, 100); printf("%X\n", $c); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); $c = imagecolorresolvealpha($im, 255,0,255,100); print_r(imagecolorsforindex($im, $c)); -imagedestroy($im); +$im = null; $im = imagecreate(5,5); for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); diff --git a/ext/gd/tests/copy.phpt b/ext/gd/tests/copy.phpt index 5f099090e66..dc0b5ca1293 100644 --- a/ext/gd/tests/copy.phpt +++ b/ext/gd/tests/copy.phpt @@ -22,7 +22,8 @@ if ($p1 && $p2 && $p3) { echo "TC/TC: ok\n"; } -imagedestroy($src_tc); imagedestroy($dst_tc); +$src_tc = null; +$dst_tc = null; $src_tc = imagecreatetruecolor(5,5); @@ -46,7 +47,8 @@ $p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff; if ($p1 && $p2 && $p3) { echo "TC/P: ok\n"; } -imagedestroy($src_tc); imagedestroy($dst_tc); +$src_tc = null; +$dst_tc = null; diff --git a/ext/gd/tests/dashedlines.phpt b/ext/gd/tests/dashedlines.phpt index 11b2e83fad4..552b2bfc297 100644 --- a/ext/gd/tests/dashedlines.phpt +++ b/ext/gd/tests/dashedlines.phpt @@ -26,7 +26,7 @@ $p5 = imagecolorat($im, 5,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5) { echo "Horizontal: ok\n"; } -imagedestroy($im); +$im = null; $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); @@ -46,7 +46,7 @@ $p6 = imagecolorat($im, 2,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { echo "Vertical: ok\n"; } -imagedestroy($im); +$im = null; $im = imagecreatetruecolor(6,6); @@ -66,9 +66,6 @@ $p6 = imagecolorat($im, 5,5) == $b; if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { echo "Diagonal: ok\n"; } -imagedestroy($im); - - ?> --EXPECT-- Horizontal: ok diff --git a/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt b/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt index c450ee6f4e4..31982cc64de 100644 --- a/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt +++ b/ext/gd/tests/imagecolorclosesthwb_basic_001.phpt @@ -21,8 +21,6 @@ gd var_dump(imagecolorclosesthwb($image, 0, 24, 200)); // 0 var_dump(imagecolorclosesthwb($image, 116, 120, 115)); // 1 var_dump(imagecolorclosesthwb($image, 50, 0, 90)); // 0 - - imagedestroy($image); ?> --EXPECT-- int(0) diff --git a/ext/gd/tests/imagecolorset_basic.phpt b/ext/gd/tests/imagecolorset_basic.phpt index 7677b85948a..006202007fa 100644 --- a/ext/gd/tests/imagecolorset_basic.phpt +++ b/ext/gd/tests/imagecolorset_basic.phpt @@ -28,7 +28,6 @@ imagecolorset($im, $bg, 0, 0, 255); imagepalettetotruecolor($im); include_once __DIR__ . '/func.inc'; test_image_equals_file(__DIR__ . '/imagecolorset_basic.png', $im); -imagedestroy($im); ?> --EXPECT-- The images are equal. diff --git a/ext/gd/tests/imagecolorstotal_basic.phpt b/ext/gd/tests/imagecolorstotal_basic.phpt index 8f90b05e235..b95275cd324 100644 --- a/ext/gd/tests/imagecolorstotal_basic.phpt +++ b/ext/gd/tests/imagecolorstotal_basic.phpt @@ -17,9 +17,6 @@ $gif = __DIR__."/php.gif"; $im = imagecreatefromgif($gif); echo 'Total colors in image: ' . imagecolorstotal($im); - -// Free image -imagedestroy($im); ?> --EXPECT-- *** Testing imagecolorstotal() : basic functionality *** diff --git a/ext/gd/tests/imagecolourstotal_basic.phpt b/ext/gd/tests/imagecolourstotal_basic.phpt index 0c9fd763247..f66a6842485 100644 --- a/ext/gd/tests/imagecolourstotal_basic.phpt +++ b/ext/gd/tests/imagecolourstotal_basic.phpt @@ -22,15 +22,13 @@ var_dump( imagecolorstotal( $img )); $bg = imagecolorallocate( $img, 255, 0, 0 ); $bg = imagecolorallocate( $img, 0, 0, 255 ); var_dump( imagecolorstotal( $img )); -imagedestroy( $img ); +$img = null; // Truecolor image $img = imagecreatetruecolor( 50, 50 ); var_dump( imagecolorstotal( $img ) ); $bg = imagecolorallocate( $img, 255, 255, 255 ); var_dump( imagecolorstotal( $img ) ); -imagedestroy( $img ); - ?> --EXPECT-- *** Testing imagecolorstotal() : basic functionality *** diff --git a/ext/gd/tests/imagecopyresampled_basic.phpt b/ext/gd/tests/imagecopyresampled_basic.phpt index 9fb1178e540..3f2f7352723 100644 --- a/ext/gd/tests/imagecopyresampled_basic.phpt +++ b/ext/gd/tests/imagecopyresampled_basic.phpt @@ -47,11 +47,6 @@ imagepng($image_sml, $dest_sml); list($width, $height) = getimagesize($dest_sml); echo "Size of copy: width=". $width . " height=" . $height . "\n"; - -imagedestroy($image_lge); -imagedestroy($image_sml); - - echo "Done\n"; ?> --CLEAN-- diff --git a/ext/gd/tests/imagecopyresampled_variation1.phpt b/ext/gd/tests/imagecopyresampled_variation1.phpt index 20734476556..6c3fd021a1a 100644 --- a/ext/gd/tests/imagecopyresampled_variation1.phpt +++ b/ext/gd/tests/imagecopyresampled_variation1.phpt @@ -59,9 +59,6 @@ if (!($alpha >= EXP_ALPHA - 1 && $alpha <= EXP_ALPHA + 1)) { printf("alpha: expected roughly %d, got %d\n", EXP_ALPHA, $alpha); } -imagedestroy($copy); -imagedestroy($im); - echo 'DONE'; ?> --EXPECT-- diff --git a/ext/gd/tests/imagedashedline_basic.phpt b/ext/gd/tests/imagedashedline_basic.phpt index d9ca69ad5f0..f676abd921d 100644 --- a/ext/gd/tests/imagedashedline_basic.phpt +++ b/ext/gd/tests/imagedashedline_basic.phpt @@ -41,7 +41,6 @@ $color1 = imagecolorsforindex($image, $col1); $color2 = imagecolorsforindex($image, $col2); var_dump($color1, $color2); -imagedestroy($image); echo "Done\n"; ?> --CLEAN-- diff --git a/ext/gd/tests/imagedestroy_deprecated.phpt b/ext/gd/tests/imagedestroy_deprecated.phpt new file mode 100644 index 00000000000..37c39fbfe27 --- /dev/null +++ b/ext/gd/tests/imagedestroy_deprecated.phpt @@ -0,0 +1,11 @@ +--TEST-- +imagedestroy() deprecation message +--EXTENSIONS-- +gd +--FILE-- + +--EXPECTF-- +Deprecated: Function imagedestroy() is deprecated since 8.5, as it has no effect since PHP 8.0 in %s on line %d diff --git a/ext/gd/tests/imagefill_1.phpt b/ext/gd/tests/imagefill_1.phpt index d8631f73cc4..113c1c98438 100644 --- a/ext/gd/tests/imagefill_1.phpt +++ b/ext/gd/tests/imagefill_1.phpt @@ -18,7 +18,6 @@ $green = imagecolorallocate($im, 0,255,0); print_r(imagecolorat($im, 0,0)); imagefill($im, 0,0,$white + 3); print_r(imagecolorat($im, 0,0)); -imagedestroy($im); ?> --EXPECT-- 00 diff --git a/ext/gd/tests/imagefilledpolygon_basic.phpt b/ext/gd/tests/imagefilledpolygon_basic.phpt index bbb8f9c2eb0..3681d96c6e7 100644 --- a/ext/gd/tests/imagefilledpolygon_basic.phpt +++ b/ext/gd/tests/imagefilledpolygon_basic.phpt @@ -55,9 +55,6 @@ $color2 = imagecolorsforindex($image_in, $col2); $color3 = imagecolorsforindex($image_in, $col3); var_dump($color1, $color2, $color3); -imagedestroy($image); -imagedestroy($image_in); - echo "Done\n"; ?> --CLEAN-- diff --git a/ext/gd/tests/imagefttext.phpt b/ext/gd/tests/imagefttext.phpt index a60c4d8afba..83243a78e52 100644 --- a/ext/gd/tests/imagefttext.phpt +++ b/ext/gd/tests/imagefttext.phpt @@ -40,11 +40,10 @@ gd $im = imagecreate(256, 256); var_dump(testrun($im, $fontfile_8859)); - imagedestroy($im); + $im = null; $im = imagecreatetruecolor(256, 256); var_dump(testrun($im, $fontfile_8859)); - imagedestroy($im); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/imagepalettetotruecolor_basic.phpt b/ext/gd/tests/imagepalettetotruecolor_basic.phpt index e4e4ee89ca1..d886227a15e 100644 --- a/ext/gd/tests/imagepalettetotruecolor_basic.phpt +++ b/ext/gd/tests/imagepalettetotruecolor_basic.phpt @@ -11,7 +11,6 @@ var_dump($im instanceof GdImage); var_dump(imageistruecolor($im)); var_dump(imagepalettetotruecolor($im)); var_dump(imageistruecolor($im)); -imagedestroy($im); ?> --EXPECT-- bool(true) diff --git a/ext/gd/tests/imagepolygon_basic.phpt b/ext/gd/tests/imagepolygon_basic.phpt index c41b0710ef4..741f34c48ab 100644 --- a/ext/gd/tests/imagepolygon_basic.phpt +++ b/ext/gd/tests/imagepolygon_basic.phpt @@ -42,8 +42,6 @@ $color1 = imagecolorsforindex($image, $col1); $color2 = imagecolorsforindex($image, $col2); var_dump($color1, $color2); -imagedestroy($image); - echo "Done\n"; ?> --CLEAN-- diff --git a/ext/gd/tests/imagerotate_overflow.phpt b/ext/gd/tests/imagerotate_overflow.phpt index a7be335ca92..590f4d7152c 100644 --- a/ext/gd/tests/imagerotate_overflow.phpt +++ b/ext/gd/tests/imagerotate_overflow.phpt @@ -11,14 +11,6 @@ $tmp = imagerotate ($im, 5, -9999999); var_dump($tmp); -if ($tmp) { - imagedestroy($tmp); -} - -if ($im) { - imagedestroy($im); -} - ?> --EXPECT-- bool(false) diff --git a/ext/gd/tests/imagettftext_charmap_order.phpt b/ext/gd/tests/imagettftext_charmap_order.phpt index 32d5c9d0d7e..6fe5353e9fc 100644 --- a/ext/gd/tests/imagettftext_charmap_order.phpt +++ b/ext/gd/tests/imagettftext_charmap_order.phpt @@ -61,7 +61,6 @@ if ($black_pixels >= 10) { } else { printf("FAIL %d black pixels\n", $black_pixels); } -imagedestroy($im); ?> --EXPECTF-- SUCCESS %d black pixels diff --git a/ext/gd/tests/libgd00100.phpt b/ext/gd/tests/libgd00100.phpt index 80e24d0ba20..8f9955640b3 100644 --- a/ext/gd/tests/libgd00100.phpt +++ b/ext/gd/tests/libgd00100.phpt @@ -109,8 +109,6 @@ imagefilledpolygon($im, $points, $black); include_once __DIR__ . '/func.inc'; test_image_equals_file(__DIR__ . '/libgd00100.png', $im); - -imagedestroy($im); ?> --EXPECT-- The images are equal. diff --git a/ext/gd/tests/libgd00186.phpt b/ext/gd/tests/libgd00186.phpt index fb9e2985ced..142f1637b2b 100644 --- a/ext/gd/tests/libgd00186.phpt +++ b/ext/gd/tests/libgd00186.phpt @@ -26,8 +26,6 @@ if ($arr['blue'] == 2) { } else { $r = "Failed"; } -imagedestroy($tile); -imagedestroy($im); echo $r; ?> --EXPECT-- diff --git a/ext/standard/tests/image/bug70096.phpt b/ext/standard/tests/image/bug70096.phpt index 53ceddea06a..757287d5aed 100644 --- a/ext/standard/tests/image/bug70096.phpt +++ b/ext/standard/tests/image/bug70096.phpt @@ -11,7 +11,6 @@ if (!function_exists('imagejpeg')) die('skip imagejpeg not available'); $filename = __DIR__ . '/bug70096.jpg'; $im = imagecreatetruecolor(10, 10); imagejpeg($im, $filename); -imagedestroy($im); $data = "\x1C\x02x\x00\x0ATest image" . "\x1C\x02t\x00\x22Copyright 2008-2009, The PHP Group"; $content1 = iptcembed($data, $filename);