Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
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
1 change: 1 addition & 0 deletions ext/gd/gd.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
1 change: 1 addition & 0 deletions ext/gd/gd.stub.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice in the RFC, but the consistent wording with the existing functions would be:

Suggested change
#[\Deprecated(since: '8.5', message: "as it has no effect since PHP 8.0")]
#[\Deprecated(since: '8.5', message: "as GdImage objects are freed automatically")]

@DanielEScherzerDanielEScherzerAug 12, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we proposed the wording on the RFC, I'd prefer to start with using that message and then we can tweak it in a separate patch if desired; same for the other patches for the no-op deprecations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay with me (that's why I opted just to comment rather than “Request Changes”).

function imagedestroy(GdImage $image): true {}

function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
Expand Down
12 changes: 10 additions & 2 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions ext/gd/tests/bug19366.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand All@@ -46,5 +44,4 @@ Alive: Define colors
Alive: Draw
Alive: ImageString
Alive: Send to browser
Alive: Free resources
Alive: Done
2 changes: 0 additions & 2 deletions ext/gd/tests/bug28147.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697-mb.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/tests/bug36697.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$im = null;
unset($im);

I have a feeling that unset() would capture the intent a little better, but no strong opinion.

$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug38179.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
2 changes: 0 additions & 2 deletions ext/gd/tests/bug42434.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ if (imagecolorat($im, 9, 0) == 0x000000) {
} else {
echo 'Bugged';
}

imagedestroy($im);
?>
--EXPECT--
DONE
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43121.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug43828.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug45799.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ if (!(imagetypes() & IMG_PNG)) {
<?php
$img = imagecreate(500,500);
imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d
2 changes: 0 additions & 2 deletions ext/gd/tests/bug50194.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
1 change: 0 additions & 1 deletion ext/gd/tests/bug61221.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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)
2 changes: 0 additions & 2 deletions ext/gd/tests/bug65148.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug67325.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,8 +24,6 @@ for ($i = 0; $i < 256; $i++) {
}
}
var_dump($white);

imagedestroy($im);
?>
--EXPECT--
int(0)
4 changes: 0 additions & 4 deletions ext/gd/tests/bug67447.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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)
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug69024.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,6 @@ gd
<?php
$im = imagecreate(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
echo "done\n";
?>
--EXPECT--
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug70102.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
3 changes: 0 additions & 3 deletions ext/gd/tests/bug72339.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,9 +33,6 @@ fclose($fh);

$im = imagecreatefromgd2($fname);

if ($im) {
imagedestroy($im);
}
unlink($fname);

?>
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/bug72709.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,6 @@ catch (\Error $ex) {
}

imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
--EXPECT--
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_auto.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/bug77198_threshold.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
}
}

Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/colorat.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand Down
12 changes: 6 additions & 6 deletions ext/gd/tests/colorclosest.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand All@@ -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);
Expand Down
4 changes: 1 addition & 3 deletions ext/gd/tests/colorexact.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ext/gd/tests/colormatch.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,6 @@ try {
}

echo "ok\n";

imagedestroy($im);
?>
--EXPECT--
imagecolormatch(): Argument #2 ($image2) must have at least one color
Expand Down
8 changes: 4 additions & 4 deletions ext/gd/tests/colorresolve.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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);
Expand Down
6 changes: 4 additions & 2 deletions ext/gd/tests/copy.phpt
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -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;



Expand Down
Loading