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