@@ -11,6 +11,8 @@ if(!function_exists('imagecreatetruecolor')) {
11
11
?>
12
12
--FILE--
13
13
<?php
14
+ require __DIR__ . '/func.inc ' ;
15
+
14
16
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
15
17
* Description: Allocate a color for an image
16
18
* Source code: ext/gd/gd.c
@@ -34,75 +36,42 @@ foreach($values as $key => $value) {
34
36
//Need to be created every time to get expected return value
35
37
$ im_palette = imagecreate (200 , 200 );
36
38
$ im_true_color = imagecreatetruecolor (200 , 200 );
37
- var_dump ( imagecolorallocate ($ im_palette , $ value , 0 , 0 ) );
38
- var_dump ( imagecolorallocate ($ im_true_color , $ value , 0 , 0 ) );
39
- var_dump ( imagecolorallocate ($ im_palette , 0 , $ value , 0 ) );
40
- var_dump ( imagecolorallocate ($ im_true_color , 0 , $ value , 0 ) );
41
- var_dump ( imagecolorallocate ($ im_palette , 0 , 0 , $ value ) );
42
- var_dump ( imagecolorallocate ($ im_true_color , 0 , 0 , $ value ) );
39
+
40
+ trycatch_dump (
41
+ fn () => imagecolorallocate ($ im_palette , $ value , 0 , 0 ),
42
+ fn () => imagecolorallocate ($ im_true_color , $ value , 0 , 0 ),
43
+ fn () => imagecolorallocate ($ im_palette , 0 , $ value , 0 ),
44
+ fn () => imagecolorallocate ($ im_true_color , 0 , $ value , 0 ),
45
+ fn () => imagecolorallocate ($ im_palette , 0 , 0 , $ value ),
46
+ fn () => imagecolorallocate ($ im_true_color , 0 , 0 , $ value )
47
+ );
43
48
};
44
49
?>
45
50
===DONE===
46
- --EXPECTF --
51
+ --EXPECT --
47
52
*** Testing imagecolorallocate() : usage variations ***
48
53
49
54
--Decimal 256--
50
-
51
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
52
- bool(false)
53
-
54
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
55
- bool(false)
56
-
57
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
58
- bool(false)
59
-
60
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
61
- bool(false)
62
-
63
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
64
- bool(false)
65
-
66
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
67
- bool(false)
55
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
56
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
57
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
58
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
59
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
60
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
68
61
69
62
--Octal 0400--
70
-
71
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
72
- bool(false)
73
-
74
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
75
- bool(false)
76
-
77
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
78
- bool(false)
79
-
80
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
81
- bool(false)
82
-
83
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
84
- bool(false)
85
-
86
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
87
- bool(false)
63
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
64
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
65
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
66
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
67
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
68
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
88
69
89
70
--Hexa-decimal 0x100--
90
-
91
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
92
- bool(false)
93
-
94
- Warning: imagecolorallocate(): Red component is out of range in %s on line %d
95
- bool(false)
96
-
97
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
98
- bool(false)
99
-
100
- Warning: imagecolorallocate(): Green component is out of range in %s on line %d
101
- bool(false)
102
-
103
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
104
- bool(false)
105
-
106
- Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
107
- bool(false)
71
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
72
+ !! [Error] Red component is out of range, must be between 0 and 255 (inclusive)
73
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
74
+ !! [Error] Green component is out of range, must be between 0 and 255 (inclusive)
75
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
76
+ !! [Error] Blue component is out of range, must be between 0 and 255 (inclusive)
108
77
===DONE===
0 commit comments