[RFC] Deprecate imagedestroy() (#19454)

https://wiki.php.net/rfc/deprecations_php_8_5
This commit is contained in:
Daniel Scherzer 2025-08-12 05:50:09 -07:00 committed by GitHub
parent 699e5632b1
commit a68f3d6374
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 44 additions and 103 deletions

View file

@ -34,6 +34,7 @@
#include "ext/standard/info.h" #include "ext/standard/info.h"
#include "php_open_temporary_file.h" #include "php_open_temporary_file.h"
#include "php_memory_streams.h" #include "php_memory_streams.h"
#include "zend_attributes.h"
#include "zend_object_handlers.h" #include "zend_object_handlers.h"
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H

View file

@ -629,6 +629,7 @@ function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = 128, i
/** @param resource|string|null $file */ /** @param resource|string|null $file */
function imagebmp(GdImage $image, $file = null, bool $compressed = true): bool {} 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 imagedestroy(GdImage $image): true {}
function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {} function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}

12
ext/gd/gd_arginfo.h generated
View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* 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_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
@ -759,7 +759,7 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(imagegd, arginfo_imagegd) ZEND_FE(imagegd, arginfo_imagegd)
ZEND_FE(imagegd2, arginfo_imagegd2) ZEND_FE(imagegd2, arginfo_imagegd2)
ZEND_FE(imagebmp, arginfo_imagebmp) 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(imagecolorallocate, arginfo_imagecolorallocate)
ZEND_FE(imagepalettecopy, arginfo_imagepalettecopy) ZEND_FE(imagepalettecopy, arginfo_imagepalettecopy)
ZEND_FE(imagecolorat, arginfo_imagecolorat) 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_FILTER_PAETH", 0x80, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x8 | 0x10 | 0x20 | 0x40 | 0x80, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x8 | 0x10 | 0x20 | 0x40 | 0x80, CONST_PERSISTENT);
#endif #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) static zend_class_entry *register_class_GdImage(void)

View file

@ -36,8 +36,6 @@ echo "Alive: Send to browser\n";
//Header("Content-type: image/PNG"); //Header("Content-type: image/PNG");
//ImagePNG($ImHandle); //ImagePNG($ImHandle);
echo "Alive: Free resources\n";
imagedestroy($ImHandle);
echo "Alive: Done\n"; echo "Alive: Done\n";
?> ?>
--EXPECT-- --EXPECT--
@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw Alive: Draw
Alive: ImageString Alive: ImageString
Alive: Send to browser Alive: Send to browser
Alive: Free resources
Alive: Done Alive: Done

View file

@ -16,8 +16,6 @@ imagefilledrectangle($im,0,0,299,299,$w);
imageantialias($im,true); imageantialias($im,true);
imageline($im, 299, 299, 0, 299, $red); imageline($im, 299, 299, 0, 299, $red);
imagedestroy($im);
echo "Alive\n"; echo "Alive\n";
?> ?>
--EXPECT-- --EXPECT--

View file

@ -13,7 +13,7 @@ imagecolortransparent($im, $trans_color);
imagefilledrectangle($im, 0,0, 192,36, $trans_color); imagefilledrectangle($im, 0,0, 192,36, $trans_color);
$c = imagecolorat($im, 191,35); $c = imagecolorat($im, 191,35);
imagegif($im, $dest); imagegif($im, $dest);
imagedestroy($im); $im = null;
$im = imagecreatefromgif($dest); $im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35); $c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c); $colors = imagecolorsforindex($im, $c);

View file

@ -13,7 +13,7 @@ imagecolortransparent($im, $trans_color);
imagefilledrectangle($im, 0,0, 192,36, $trans_color); imagefilledrectangle($im, 0,0, 192,36, $trans_color);
$c = imagecolorat($im, 191,35); $c = imagecolorat($im, 191,35);
imagegif($im, $dest); imagegif($im, $dest);
imagedestroy($im); $im = null;
$im = imagecreatefromgif($dest); $im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35); $c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c); $colors = imagecolorsforindex($im, $c);

View file

@ -18,8 +18,6 @@ imagecopy($dst_tc, $src, 0,0, 0,0, imagesx($src), imagesy($src));
$p1 = imagecolorat($dst_tc, 3,3); $p1 = imagecolorat($dst_tc, 3,3);
printf("%X\n", $p1); printf("%X\n", $p1);
imagedestroy($src); imagedestroy($dst_tc);
?> ?>
--EXPECT-- --EXPECT--
46FF0000 46FF0000

View file

@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else { } else {
echo 'Bugged'; echo 'Bugged';
} }
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
DONE DONE

View file

@ -17,8 +17,6 @@ $im_tile = ImageCreateFromGif(__DIR__ . "/bug43121.gif" );
ImageSetTile( $im, $im_tile ); ImageSetTile( $im, $im_tile );
ImageFill( $im, 0, 0, IMG_COLOR_TILED ); ImageFill( $im, 0, 0, IMG_COLOR_TILED );
ImageDestroy( $im );
print "OK"; print "OK";
?> ?>
--EXPECT-- --EXPECT--

View file

@ -23,8 +23,6 @@ imagefilledarc($im, 49, 49, 99,99, 0 , 360, $color, IMG_ARC_PIE);
include_once __DIR__ . '/func.inc'; include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug43828.png', $im); test_image_equals_file(__DIR__ . '/bug43828.png', $im);
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
The images are equal. The images are equal.

View file

@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php <?php
$img = imagecreate(500,500); $img = imagecreate(500,500);
imagepng($img); imagepng($img);
imagedestroy($img);
?> ?>
--EXPECTF-- --EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d

View file

@ -32,8 +32,6 @@ if (isset($matches[1]) && $matches[1] > 2000) {
} else { } else {
echo "The images are similar.\n"; echo "The images are similar.\n";
} }
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
The images are similar. The images are similar.

View file

@ -15,7 +15,6 @@ imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
imagegammacorrect($img, 1, 1); imagegammacorrect($img, 1, 1);
$color = imagecolorat($img, 0, 0); $color = imagecolorat($img, 0, 0);
var_dump($color === $blacktransparent); var_dump($color === $blacktransparent);
imagedestroy($img);
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)

View file

@ -37,10 +37,8 @@ foreach ($interpolations as $name => $interpolation) {
$t = imagecolorallocatealpha($img, 0, 0, 0, 127); $t = imagecolorallocatealpha($img, 0, 0, 0, 127);
$imgr = imagerotate($img, -5, $t); $imgr = imagerotate($img, -5, $t);
$results[$name] = array('x' => imagesx($imgr), 'y' => imagesy($imgr)); $results[$name] = array('x' => imagesx($imgr), 'y' => imagesy($imgr));
imagedestroy($imgr);
} }
imagedestroy($img);
print_r($results); print_r($results);
?> ?>
--EXPECT-- --EXPECT--

View file

@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
} }
} }
var_dump($white); var_dump($white);
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
int(0) int(0)

View file

@ -10,8 +10,6 @@ $red = imagecolorallocate($image, 255, 0, 0);
imagefill($image, 0, 0, $red); imagefill($image, 0, 0, $red);
$cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]); $cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]);
var_dump(imagecolorat($cropped, 249, 249) === $red); var_dump(imagecolorat($cropped, 249, 249) === $red);
imagedestroy($image);
imagedestroy($cropped);
// palette // palette
$image = imagecreate(500, 500); $image = imagecreate(500, 500);
@ -20,8 +18,6 @@ $red = imagecolorallocate($image, 255, 0, 0);
imagefill($image, 0, 0, $red); imagefill($image, 0, 0, $red);
$cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]); $cropped = imagecrop($image, ['x' => 0, 'y' => 0, 'width' => 250, 'height' => 250]);
var_dump(imagecolorsforindex($cropped, imagecolorat($cropped, 249, 249))); var_dump(imagecolorsforindex($cropped, imagecolorat($cropped, 249, 249)));
imagedestroy($image);
imagedestroy($cropped);
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)

View file

@ -6,7 +6,6 @@ gd
<?php <?php
$im = imagecreate(256, 256); $im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC); imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n"; echo "done\n";
?> ?>
--EXPECT-- --EXPECT--

View file

@ -19,7 +19,6 @@ $white = imagecolorallocate($im, 255, 255, 255);
var_dump($white & 0xffffff); var_dump($white & 0xffffff);
imagefilledrectangle($im, 0, 0, 7, 7, $white); imagefilledrectangle($im, 0, 0, 7, 7, $white);
imagewebp($im, $filename); imagewebp($im, $filename);
imagedestroy($im);
$im = imagecreatefromwebp($filename); $im = imagecreatefromwebp($filename);
$color = imagecolorat($im, 4, 4); $color = imagecolorat($im, 4, 4);

View file

@ -33,9 +33,6 @@ fclose($fh);
$im = imagecreatefromgd2($fname); $im = imagecreatefromgd2($fname);
if ($im) {
imagedestroy($im);
}
unlink($fname); unlink($fname);
?> ?>

View file

@ -14,7 +14,6 @@ catch (\Error $ex) {
} }
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED); imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?> ?>
====DONE==== ====DONE====
--EXPECT-- --EXPECT--

View file

@ -39,9 +39,7 @@ for ($y = 0; $y < 8; $y++) {
if ($color !== 0x000000) { if ($color !== 0x000000) {
printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color); printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color);
} }
imagedestroy($cropped);
} }
imagedestroy($orig);
} }
} }

View file

@ -36,9 +36,7 @@ for ($y = 0; $y < 8; $y++) {
if ($color !== 0x000000) { if ($color !== 0x000000) {
printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color); printf("Pixel at %d, %d: unexpected color (%d)\n", $x, $y, $color);
} }
imagedestroy($cropped);
} }
imagedestroy($orig);
} }
} }

View file

@ -15,7 +15,6 @@ echo 'test colorat truecolor: ';
$c = imagecolorat($im, 3,3); $c = imagecolorat($im, 3,3);
echo $c == 0x0 ? 'ok' : 'failed'; echo $c == 0x0 ? 'ok' : 'failed';
echo "\n"; echo "\n";
imagedestroy($im);
$im = imagecreate(6,6); $im = imagecreate(6,6);
$c1 = imagecolorallocate($im, 255,255,255); $c1 = imagecolorallocate($im, 255,255,255);

View file

@ -8,7 +8,7 @@ gd
$im = imagecreatetruecolor(5,5); $im = imagecreatetruecolor(5,5);
$c = imagecolorclosest($im, 255,0,255); $c = imagecolorclosest($im, 255,0,255);
printf("%X\n", $c); printf("%X\n", $c);
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
$c = imagecolorclosest($im, 255,0,255); $c = imagecolorclosest($im, 255,0,255);
@ -17,13 +17,13 @@ try {
} catch (ValueError $exception) { } catch (ValueError $exception) {
echo $exception->getMessage() . "\n"; echo $exception->getMessage() . "\n";
} }
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
imagecolorallocate($im, 255, 0, 255); imagecolorallocate($im, 255, 0, 255);
$c = imagecolorclosest($im, 255,0,255); $c = imagecolorclosest($im, 255,0,255);
print_r(imagecolorsforindex($im, $c)); print_r(imagecolorsforindex($im, $c));
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0); for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0);
@ -46,7 +46,7 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreatetruecolor(5,5); $im = imagecreatetruecolor(5,5);
$c = imagecolorclosestalpha($im, 255,0,255,100); $c = imagecolorclosestalpha($im, 255,0,255,100);
printf("%X\n", $c); printf("%X\n", $c);
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
$c = imagecolorclosestalpha($im, 255,0,255,100); $c = imagecolorclosestalpha($im, 255,0,255,100);
@ -55,13 +55,13 @@ try {
} catch (ValueError $exception) { } catch (ValueError $exception) {
echo $exception->getMessage() . "\n"; echo $exception->getMessage() . "\n";
} }
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
imagecolorallocatealpha($im, 255, 0, 255, 1); imagecolorallocatealpha($im, 255, 0, 255, 1);
$c = imagecolorclosestalpha($im, 255,0,255,1); $c = imagecolorclosestalpha($im, 255,0,255,1);
print_r(imagecolorsforindex($im, $c)); print_r(imagecolorsforindex($im, $c));
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1);

View file

@ -12,7 +12,7 @@ $c2 = imagecolorexactalpha($im, 255,0,255, 100);
printf("%X\n", $c); printf("%X\n", $c);
printf("%X\n", $c2); printf("%X\n", $c2);
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
$c = imagecolorallocate($im, 255,0,255); $c = imagecolorallocate($im, 255,0,255);
@ -26,8 +26,6 @@ echo imagecolorexactalpha($im, 255,200,0,100) . "\n";
// unallocated index // unallocated index
echo imagecolorexact($im, 12,12,12) . "\n"; echo imagecolorexact($im, 12,12,12) . "\n";
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
FF00FF FF00FF

View file

@ -15,8 +15,6 @@ try {
} }
echo "ok\n"; echo "ok\n";
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color imagecolormatch(): Argument #2 ($image2) must have at least one color

View file

@ -8,12 +8,12 @@ gd
$im = imagecreatetruecolor(5,5); $im = imagecreatetruecolor(5,5);
$c = imagecolorresolve($im, 255,0,255); $c = imagecolorresolve($im, 255,0,255);
printf("%X\n", $c); printf("%X\n", $c);
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
$c = imagecolorresolve($im, 255,0,255); $c = imagecolorresolve($im, 255,0,255);
print_r(imagecolorsforindex($im, $c)); print_r(imagecolorsforindex($im, $c));
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0); for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0);
@ -38,12 +38,12 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreatetruecolor(5,5); $im = imagecreatetruecolor(5,5);
$c = imagecolorresolvealpha($im, 255,0,255, 100); $c = imagecolorresolvealpha($im, 255,0,255, 100);
printf("%X\n", $c); printf("%X\n", $c);
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
$c = imagecolorresolvealpha($im, 255,0,255,100); $c = imagecolorresolvealpha($im, 255,0,255,100);
print_r(imagecolorsforindex($im, $c)); print_r(imagecolorsforindex($im, $c));
imagedestroy($im); $im = null;
$im = imagecreate(5,5); $im = imagecreate(5,5);
for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1);

View file

@ -22,7 +22,8 @@ if ($p1 && $p2 && $p3) {
echo "TC/TC: ok\n"; echo "TC/TC: ok\n";
} }
imagedestroy($src_tc); imagedestroy($dst_tc); $src_tc = null;
$dst_tc = null;
$src_tc = imagecreatetruecolor(5,5); $src_tc = imagecreatetruecolor(5,5);
@ -46,7 +47,8 @@ $p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff;
if ($p1 && $p2 && $p3) { if ($p1 && $p2 && $p3) {
echo "TC/P: ok\n"; echo "TC/P: ok\n";
} }
imagedestroy($src_tc); imagedestroy($dst_tc); $src_tc = null;
$dst_tc = null;

View file

@ -26,7 +26,7 @@ $p5 = imagecolorat($im, 5,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5) { if ($p1 && $p2 && $p3 && $p4 && $p5) {
echo "Horizontal: ok\n"; echo "Horizontal: ok\n";
} }
imagedestroy($im); $im = null;
$im = imagecreatetruecolor(6,6); $im = imagecreatetruecolor(6,6);
imagefill($im, 0,0, 0xffffff); imagefill($im, 0,0, 0xffffff);
@ -46,7 +46,7 @@ $p6 = imagecolorat($im, 2,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
echo "Vertical: ok\n"; echo "Vertical: ok\n";
} }
imagedestroy($im); $im = null;
$im = imagecreatetruecolor(6,6); $im = imagecreatetruecolor(6,6);
@ -66,9 +66,6 @@ $p6 = imagecolorat($im, 5,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) { if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
echo "Diagonal: ok\n"; echo "Diagonal: ok\n";
} }
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
Horizontal: ok Horizontal: ok

View file

@ -21,8 +21,6 @@ gd
var_dump(imagecolorclosesthwb($image, 0, 24, 200)); // 0 var_dump(imagecolorclosesthwb($image, 0, 24, 200)); // 0
var_dump(imagecolorclosesthwb($image, 116, 120, 115)); // 1 var_dump(imagecolorclosesthwb($image, 116, 120, 115)); // 1
var_dump(imagecolorclosesthwb($image, 50, 0, 90)); // 0 var_dump(imagecolorclosesthwb($image, 50, 0, 90)); // 0
imagedestroy($image);
?> ?>
--EXPECT-- --EXPECT--
int(0) int(0)

View file

@ -28,7 +28,6 @@ imagecolorset($im, $bg, 0, 0, 255);
imagepalettetotruecolor($im); imagepalettetotruecolor($im);
include_once __DIR__ . '/func.inc'; include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/imagecolorset_basic.png', $im); test_image_equals_file(__DIR__ . '/imagecolorset_basic.png', $im);
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
The images are equal. The images are equal.

View file

@ -17,9 +17,6 @@ $gif = __DIR__."/php.gif";
$im = imagecreatefromgif($gif); $im = imagecreatefromgif($gif);
echo 'Total colors in image: ' . imagecolorstotal($im); echo 'Total colors in image: ' . imagecolorstotal($im);
// Free image
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
*** Testing imagecolorstotal() : basic functionality *** *** Testing imagecolorstotal() : basic functionality ***

View file

@ -22,15 +22,13 @@ var_dump( imagecolorstotal( $img ));
$bg = imagecolorallocate( $img, 255, 0, 0 ); $bg = imagecolorallocate( $img, 255, 0, 0 );
$bg = imagecolorallocate( $img, 0, 0, 255 ); $bg = imagecolorallocate( $img, 0, 0, 255 );
var_dump( imagecolorstotal( $img )); var_dump( imagecolorstotal( $img ));
imagedestroy( $img ); $img = null;
// Truecolor image // Truecolor image
$img = imagecreatetruecolor( 50, 50 ); $img = imagecreatetruecolor( 50, 50 );
var_dump( imagecolorstotal( $img ) ); var_dump( imagecolorstotal( $img ) );
$bg = imagecolorallocate( $img, 255, 255, 255 ); $bg = imagecolorallocate( $img, 255, 255, 255 );
var_dump( imagecolorstotal( $img ) ); var_dump( imagecolorstotal( $img ) );
imagedestroy( $img );
?> ?>
--EXPECT-- --EXPECT--
*** Testing imagecolorstotal() : basic functionality *** *** Testing imagecolorstotal() : basic functionality ***

View file

@ -47,11 +47,6 @@ imagepng($image_sml, $dest_sml);
list($width, $height) = getimagesize($dest_sml); list($width, $height) = getimagesize($dest_sml);
echo "Size of copy: width=". $width . " height=" . $height . "\n"; echo "Size of copy: width=". $width . " height=" . $height . "\n";
imagedestroy($image_lge);
imagedestroy($image_sml);
echo "Done\n"; echo "Done\n";
?> ?>
--CLEAN-- --CLEAN--

View file

@ -59,9 +59,6 @@ if (!($alpha >= EXP_ALPHA - 1 && $alpha <= EXP_ALPHA + 1)) {
printf("alpha: expected roughly %d, got %d\n", EXP_ALPHA, $alpha); printf("alpha: expected roughly %d, got %d\n", EXP_ALPHA, $alpha);
} }
imagedestroy($copy);
imagedestroy($im);
echo 'DONE'; echo 'DONE';
?> ?>
--EXPECT-- --EXPECT--

View file

@ -41,7 +41,6 @@ $color1 = imagecolorsforindex($image, $col1);
$color2 = imagecolorsforindex($image, $col2); $color2 = imagecolorsforindex($image, $col2);
var_dump($color1, $color2); var_dump($color1, $color2);
imagedestroy($image);
echo "Done\n"; echo "Done\n";
?> ?>
--CLEAN-- --CLEAN--

View file

@ -0,0 +1,11 @@
--TEST--
imagedestroy() deprecation message
--EXTENSIONS--
gd
--FILE--
<?php
$img = imagecreate(5,5);
imagedestroy($img);
?>
--EXPECTF--
Deprecated: Function imagedestroy() is deprecated since 8.5, as it has no effect since PHP 8.0 in %s on line %d

View file

@ -18,7 +18,6 @@ $green = imagecolorallocate($im, 0,255,0);
print_r(imagecolorat($im, 0,0)); print_r(imagecolorat($im, 0,0));
imagefill($im, 0,0,$white + 3); imagefill($im, 0,0,$white + 3);
print_r(imagecolorat($im, 0,0)); print_r(imagecolorat($im, 0,0));
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
00 00

View file

@ -55,9 +55,6 @@ $color2 = imagecolorsforindex($image_in, $col2);
$color3 = imagecolorsforindex($image_in, $col3); $color3 = imagecolorsforindex($image_in, $col3);
var_dump($color1, $color2, $color3); var_dump($color1, $color2, $color3);
imagedestroy($image);
imagedestroy($image_in);
echo "Done\n"; echo "Done\n";
?> ?>
--CLEAN-- --CLEAN--

View file

@ -40,11 +40,10 @@ gd
$im = imagecreate(256, 256); $im = imagecreate(256, 256);
var_dump(testrun($im, $fontfile_8859)); var_dump(testrun($im, $fontfile_8859));
imagedestroy($im); $im = null;
$im = imagecreatetruecolor(256, 256); $im = imagecreatetruecolor(256, 256);
var_dump(testrun($im, $fontfile_8859)); var_dump(testrun($im, $fontfile_8859));
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)

View file

@ -11,7 +11,6 @@ var_dump($im instanceof GdImage);
var_dump(imageistruecolor($im)); var_dump(imageistruecolor($im));
var_dump(imagepalettetotruecolor($im)); var_dump(imagepalettetotruecolor($im));
var_dump(imageistruecolor($im)); var_dump(imageistruecolor($im));
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
bool(true) bool(true)

View file

@ -42,8 +42,6 @@ $color1 = imagecolorsforindex($image, $col1);
$color2 = imagecolorsforindex($image, $col2); $color2 = imagecolorsforindex($image, $col2);
var_dump($color1, $color2); var_dump($color1, $color2);
imagedestroy($image);
echo "Done\n"; echo "Done\n";
?> ?>
--CLEAN-- --CLEAN--

View file

@ -11,14 +11,6 @@ $tmp = imagerotate ($im, 5, -9999999);
var_dump($tmp); var_dump($tmp);
if ($tmp) {
imagedestroy($tmp);
}
if ($im) {
imagedestroy($im);
}
?> ?>
--EXPECT-- --EXPECT--
bool(false) bool(false)

View file

@ -61,7 +61,6 @@ if ($black_pixels >= 10) {
} else { } else {
printf("FAIL %d black pixels\n", $black_pixels); printf("FAIL %d black pixels\n", $black_pixels);
} }
imagedestroy($im);
?> ?>
--EXPECTF-- --EXPECTF--
SUCCESS %d black pixels SUCCESS %d black pixels

View file

@ -109,8 +109,6 @@ imagefilledpolygon($im, $points, $black);
include_once __DIR__ . '/func.inc'; include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/libgd00100.png', $im); test_image_equals_file(__DIR__ . '/libgd00100.png', $im);
imagedestroy($im);
?> ?>
--EXPECT-- --EXPECT--
The images are equal. The images are equal.

View file

@ -26,8 +26,6 @@ if ($arr['blue'] == 2) {
} else { } else {
$r = "Failed"; $r = "Failed";
} }
imagedestroy($tile);
imagedestroy($im);
echo $r; echo $r;
?> ?>
--EXPECT-- --EXPECT--

View file

@ -11,7 +11,6 @@ if (!function_exists('imagejpeg')) die('skip imagejpeg not available');
$filename = __DIR__ . '/bug70096.jpg'; $filename = __DIR__ . '/bug70096.jpg';
$im = imagecreatetruecolor(10, 10); $im = imagecreatetruecolor(10, 10);
imagejpeg($im, $filename); imagejpeg($im, $filename);
imagedestroy($im);
$data = "\x1C\x02x\x00\x0ATest image" $data = "\x1C\x02x\x00\x0ATest image"
. "\x1C\x02t\x00\x22Copyright 2008-2009, The PHP Group"; . "\x1C\x02t\x00\x22Copyright 2008-2009, The PHP Group";
$content1 = iptcembed($data, $filename); $content1 = iptcembed($data, $filename);