Skip to content

Commit 6e0f486

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix most external GD 2.3.3 compatibility
2 parents 4e3d9b2 + 0aaad46 commit 6e0f486

29 files changed

+129
-17
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ PHP NEWS
2323
- FTP:
2424
. Fix context option check for "overwrite". (JonasQuinten)
2525

26+
- GD:
27+
. Fix most of the external libgd test failures. (Michael Orlitzky)
28+
2629
- MBString:
2730
. Fix GH-11300 (license issue: restricted unicode license headers).
2831
(nielsdos)

ext/gd/tests/bug38212-mb.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
33
--EXTENSIONS--
44
gd
5+
--SKIPIF--
6+
<?php
7+
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8+
die("skip test requires GD 2.3.2 or older");
9+
}
10+
?>
511
--FILE--
612
<?php
713
require __DIR__ . '/func.inc';

ext/gd/tests/bug38212.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
33
--EXTENSIONS--
44
gd
5+
--SKIPIF--
6+
<?php
7+
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8+
die("skip test requires GD 2.3.2 or older");
9+
}
10+
?>
511
--FILE--
612
<?php
713
require __DIR__ . '/func.inc';

ext/gd/tests/bug39780_extern.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ $im = imagecreatefrompng(__DIR__ . '/bug39780.png');
1313
var_dump($im);
1414
?>
1515
--EXPECTF--
16-
gd-png: fatal libpng error: Read Error: truncated data
17-
gd-png error: setjmp returns error condition 2
18-
Warning: imagecreatefrompng(): v%sbug39780.png" is not a valid PNG file in /%s on line %d
16+
Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data%win %s on line %d
17+
18+
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition %d%win %s on line %d
19+
20+
Warning: imagecreatefrompng(): "%sbug39780.png" is not a valid PNG file in %s on line %d
1921
bool(false)

ext/gd/tests/bug41442.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Bug #41442 (imagegd2() under output control)
44
gd
55
--SKIPIF--
66
<?php
7+
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
8+
die("skip test requires GD 2.3.2 or older");
9+
}
10+
711
if (!function_exists("imagegd2")) {
812
die("skip GD2 support unavailable");
913
}

ext/gd/tests/bug45799.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ imagepng($img);
99
imagedestroy($img);
1010
?>
1111
--EXPECTF--
12-
Warning: imagepng(): gd-png error: no colors in palette in %s on line %d
12+
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d

ext/gd/tests/bug66356.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ Array
3838
[height] => 10
3939
)
4040

41-
Warning: imagecrop(): One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
41+
Warning: imagecrop(): %cne parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
4242
in %s on line %d
4343
bool(false)
4444
object(GdImage)#2 (0) {
4545
}
4646
object(GdImage)#2 (0) {
4747
}
4848

49-
Warning: imagecrop(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
49+
Warning: imagecrop(): %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
5050
in %s on line %d
5151
bool(false)

ext/gd/tests/bug71912-mb.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Bug #71912 (libgd: signedness vulnerability)
44
gd
55
--SKIPIF--
66
<?php
7+
if (!GD_BUNDLED) {
8+
if (version_compare(GD_VERSION, '2.2.0', '<')) {
9+
die("skip test requires GD 2.2.0 or higher");
10+
}
11+
if (version_compare(GD_VERSION, '2.3.3', '>=')) {
12+
die("skip test requires GD 2.3.2 or older");
13+
}
14+
}
715
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
816
?>
917
--FILE--

ext/gd/tests/bug71912.phpt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ Bug #71912 (libgd: signedness vulnerability)
44
gd
55
--SKIPIF--
66
<?php
7-
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
8-
die("skip test requires GD 2.2.0 or higher");
7+
if (!GD_BUNDLED) {
8+
if (version_compare(GD_VERSION, '2.2.0', '<')) {
9+
die("skip test requires GD 2.2.0 or higher");
10+
}
11+
if (version_compare(GD_VERSION, '2.3.3', '>=')) {
12+
die("skip test requires GD 2.3.2 or older");
13+
}
914
}
1015
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
1116
?>

ext/gd/tests/bug72339.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ gd
55
--SKIPIF--
66
<?php
77
if (!function_exists("imagecreatefromgd2")) print "skip";
8-
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.2', '<')) {
9-
die("skip test requires GD 2.2.2 or higher");
8+
9+
if (!GD_BUNDLED) {
10+
if (version_compare(GD_VERSION, '2.2.2', '<')) {
11+
die("skip test requires GD 2.2.2 or higher");
12+
}
13+
if (version_compare(GD_VERSION, '2.3.3', '>=')) {
14+
die("skip test requires GD 2.3.2 or older");
15+
}
1016
}
1117
?>
1218
--FILE--

0 commit comments

Comments
 (0)