xref: /PHP-8.2/ext/gd/tests/bug19366.phpt (revision a375d547)
1--TEST--
2Bug #19366 (gdimagefill() function crashes (fixed in bundled libgd))
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7echo "Alive: create image\n";
8$width = 50;
9$height = 100;
10$ImHandle = imagecreate($width,$height);
11
12echo "Alive: Define colors\n";
13$MyBlue = imagecolorAllocate($ImHandle, 0, 0, 255);
14$MyRed = imagecolorAllocate($ImHandle, 255, 0, 0);
15$MyWhite = imagecolorAllocate($ImHandle, 255, 255, 255);
16$MyBlack = imagecolorAllocate($ImHandle, 0, 0, 0);
17
18echo "Alive: Draw\n";
19ImageFill($ImHandle,0,0,$MyBlack);
20ImageLine($ImHandle,20,20,180,20,$MyWhite);
21ImageLine($ImHandle,20,20,20,70,$MyBlue);
22ImageLine($ImHandle,20,70,180,70,$MyRed);
23ImageLine($ImHandle,180,20,180,45,$MyWhite);
24ImageLine($ImHandle,180,70,180,45,$MyRed);
25ImageLine($ImHandle,20,20,100,45,$MyBlue);
26ImageLine($ImHandle,20,70,100,45,$MyBlue);
27ImageLine($ImHandle,100,45,180,45,$MyRed);
28ImageFill($ImHandle,21,45,$MyBlue);
29ImageFill($ImHandle,100,69,$MyRed);
30ImageFill($ImHandle,100,21,$MyWhite);
31
32echo "Alive: ImageString\n";
33ImageString($ImHandle,4,40,75,"Czech Republic",$MyWhite);
34
35echo "Alive: Send to browser\n";
36//Header("Content-type: image/PNG");
37//ImagePNG($ImHandle);
38
39echo "Alive: Free resources\n";
40imagedestroy($ImHandle);
41echo "Alive: Done\n";
42?>
43--EXPECT--
44Alive: create image
45Alive: Define colors
46Alive: Draw
47Alive: ImageString
48Alive: Send to browser
49Alive: Free resources
50Alive: Done
51