Commit graph

2243 commits

Author SHA1 Message Date
Michael Orlitzky
0aaad46c15 Fix most external GD 2.3.3 compatibility
* ext/gd/tests/bug45799.phpt: tweak to work with external gd.

The expected output from this test contains an extra newline with
gd-2.3.3 from the system (Gentoo). Adding a whitespace wildcard takes
care of it, and the test still passes with the bundled version of gd.

* ext/gd/tests: external gd-2.3.3 compatibility.

Support for the legacy "gd" image format was removed from gd-2.3.3
upstream:
  https://github.com/libgd/libgd/blob/master/CHANGELOG.md#233---2021-09-12

Several tests for the gd extension utilize that format, and naturally
fail when gd-2.3.3 from the system is used. This commit skips those
tests when the version of gd is at least 2.3.3.

* ext/gd/tests/bug73159.phpt: skip with external gd >= 2.3.3

This test uses the imagegd2() function to check that
  https://github.com/libgd/libgd/issues/289

is fixed. When an external gd without support for the "gd" format is
used, no error is thrown, but a nonsense result is printed: this is
normal. The corresponding upstream test is disabled in that situation;
it's not expected to work.

This commit skips the corresponding PHP test under the same
circumstances to fix a test failure with external gd >= 2.3.3.

* ext/gd/tests/bug73155.phpt: skip with external gd >= 2.3.3

This test uses the imagegd2() function to check that
  https://github.com/libgd/libgd/issues/309

is fixed. When an external gd without support for the "gd" format is
used, no error is thrown, but a nonsense result is printed: this is
normal. The corresponding upstream test is disabled in that situation;
it's not expected to work.

This commit skips the corresponding PHP test under the same
circumstances to fix a test failure with external gd >= 2.3.3.

* ext/gd/tests/bug73157.phpt: skip with external gd >= 2.3.3

This test ensures that the third (chunk_size) parameter to imagegd2()
is respected when a fourth parameter is also given. However, when an
external gd without support for the "gd" format is used, the call to
imagegd2() does not really work at all. It doesn't fail, but it
produces an "image" with a nonsense chunk size.

To avoid failures when an external gd >= 2.3.3 is used, we skip the
test entirely in that case.

* ext/gd/tests/bug77973.phpt: accept lowercase "Invalid"

This test fails with an external gd because the test expects "Invalid"
where upstream gd says "invalid". This commit tweaks the expected
output to accept an arbitrary character in the i/I position.

* ext/gd/tests/bug39780_extern.phpt: update for external gd-2.3.3.

Since there are no CI runs with external gd, I can only assume that
this test has fallen out-of-date due to changes in PHP itself. I've
tweaked the expected output (only slightly) so that the test passes
with both gd-2.3.2 and gd-2.3.3.

* ext/gd/tests/bug66356.phpt: update expected output for external gd.

Newer (external) versions of GD start their error messages with
lowercase characters, whereas this test is expecting them in
uppercase. A single-character wildcard now supports both formats.

* ext/gd/tests/imagegd_truecolor.phpt: skip with external gd >= 2.3.3.

This test uses the imagegd() function, but the "gd" format has been
disabled by default in upstream gd-2.3.3. We still get some kind of
image data back from the call to imagegd(), but its "signature",
"truecolor", and "size" no longer match the expected values. This
commit skips the test when an external gd >= 2.3.3 is used.

* ext/gd/tests/createfromwbmp2_extern.phpt: update for external gd-2.3.3.
* ext/gd/tests/libgd00086_extern.phpt: update for external gd-2.3.3.

Since there are no CI runs with external gd, I can only assume that
this test has fallen out-of-date due to changes in PHP itself. I've
tweaked the expected output (only slightly) so that the test passes
with both gd-2.3.2 and gd-2.3.3.

* ext/gd/tests/bug77272.phpt: update expected output for external gd.

Newer (external) versions of GD start their error messages with
lowercase characters, whereas this test is expecting them in
uppercase. A single-character wildcard now supports both formats.

* ext/gd/tests/bug77479.phpt: update for newer external gd.

This test fails with gd-2.3.3 (at least) due to minor capitalization
and whitespace issues. We add some wildcards to account for the
difference.

Closes GH-11257.
Closes GH-11262.
Closes GH-11264.
Closes GH-11280.
2023-07-06 21:39:40 +02:00
Michael Voříšek
916b132ea0
Add Windows GitHub actions build
Closes GH-10664
2023-03-01 23:02:03 +01:00
Christoph M. Becker
b4fb66463b
Update new test to use EXTENSIONS section instead of SKIPIF 2022-10-24 15:02:05 +02:00
Stanislav Malyshev
33e10cb1e0 Merge branch 'PHP-8.0' into PHP-8.1 2022-10-23 18:49:26 -06:00
Stanislav Malyshev
1d83a407d1 Merge branch 'PHP-7.4' into PHP-8.0 2022-10-23 18:49:21 -06:00
Christoph M. Becker
d50532be91 Fix #81739: OOB read due to insufficient validation in imageloadfont()
If we swap the byte order of the relevant header bytes, we need to make
sure again that the following multiplication does not overflow.
2022-10-23 18:41:48 -06:00
Christoph M. Becker
bc8e52f651
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8848: imagecopyresized() error refers to the wrong argument
2022-06-23 15:22:09 +02:00
Christoph M. Becker
9405f43ba9
Fix GH-8848: imagecopyresized() error refers to the wrong argument
Closes GH-8849.
2022-06-23 15:20:49 +02:00
Christoph M. Becker
036bed01ce
Fix imagecreatefromavif() memory leak
This has been reported as https://github.com/libgd/libgd/issues/831.
We port the respective fix to our bundled libgd.

Closes GH-8812.
2022-06-17 17:30:57 +02:00
Christoph M. Becker
4a630e67e9
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed libpng warning when loading interlaced images
2022-02-08 10:48:21 +01:00
Brett
1d48da6da5
Fixed libpng warning when loading interlaced images
We enable interlace transform when reading png.

Closes GH-8002.
2022-02-08 10:46:50 +01:00
Remi Collet
54f1f8cf2a
add missing conditions 2021-11-25 13:20:27 +01:00
Remi Collet
f566cba0bb
fix [-Wstrict-prototypes] build warnings in ext/gd 2021-11-25 13:17:07 +01:00
Remi Collet
96a0ff73e9
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  add missing cond.
2021-11-25 10:16:17 +01:00
Remi Collet
f6621037a0
add missing cond. 2021-11-25 10:14:30 +01:00
Remi Collet
80d63e9d17
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  fix gdImagePngCtxEx call with system libgd
2021-11-25 08:27:28 +01:00
Remi Collet
e713890d36
fix gdImagePngCtxEx call with system libgd 2021-11-25 08:27:07 +01:00
Christoph M. Becker
a2c0ffb54e
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  "Export" relevant GD macros
2021-11-24 18:25:21 +01:00
Christoph M. Becker
9237055141
"Export" relevant GD macros
For parity with non Windows systems, we should `AC_DEFINE` these macros
so that they are defined in config.w32.h instead of directly passed to
the compiler.  This allows extensions which have ext/gd as dependency
to check for these macros.  E.g. ext/ps does this[1], and fails to
build on Windows, because `HAVE_GD_BUNDLED` isn't defined.

[1] <https://github.com/steinm/ps/blob/RELEASE_1_4_4/ps.c#L34>

Closes GH-7680.
2021-11-24 18:23:28 +01:00
Christoph M. Becker
7f2533d065
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #71316: libpng warning from imagecreatefromstring
2021-11-04 11:21:10 +01:00
Christoph M. Becker
f22f4afd84
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #71316: libpng warning from imagecreatefromstring
2021-11-04 11:19:24 +01:00
Christoph M. Becker
1919c4b44d
Fix #71316: libpng warning from imagecreatefromstring
We backport the respective upstream fix[1] to our bundled libgd.

[1] <636100b928>

Closes GH-7615.
2021-11-04 11:16:45 +01:00
Máté Kocsis
220f0f55cf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix the return type of imagecolorexactalpha()
  String default values are enclosed in quotes rather than apostrophes
2021-10-12 09:53:30 +02:00
Máté Kocsis
17fa9b77bd
Fix the return type of imagecolorexactalpha() 2021-10-12 09:51:13 +02:00
Ben Morss
b4c200f9fe Require libavif version >= 0.8.2
Closes GH-7554.
2021-10-05 17:01:07 +02:00
Christoph M. Becker
67131e453b
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix gdAlphaMax limit typo
2021-09-23 23:20:00 +02:00
Christoph M. Becker
c0dcd141a8
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix gdAlphaMax limit typo
2021-09-23 23:18:52 +02:00
Michael Voříšek
2c3dfe5160
Fix gdAlphaMax limit typo
Closes GH-7410.
2021-09-23 23:16:40 +02:00
Remi Collet
b3646440b1
Don't rely on libgd unused constants 2021-09-13 14:48:13 +02:00
Christoph M. Becker
c95e036813
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #53580: During resize gdImageCopyResampled cause colors change
2021-08-26 18:44:04 +02:00
Christoph M. Becker
35e1f134f5
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #53580: During resize gdImageCopyResampled cause colors change
2021-08-26 18:41:08 +02:00
Christoph M. Becker
526407ca35
Fix #53580: During resize gdImageCopyResampled cause colors change
We port the upstream fix[1], and also revert commit a3383ac3d7[2] which
is now obsolete, and also not part of libgd.  Especially the change to
gd.png.c was at best a half-baked optimization.

[1] <a24e96f019>
[2] <a3383ac3d7>

Closes GH-7402.
2021-08-26 18:38:17 +02:00
Máté Kocsis
68946bdd90
Generate optimizer func info from stubs for ext/gd and ext/pgsql (#7408) 2021-08-26 17:38:08 +02:00
Nikita Popov
6e1bedea5b Merge branch 'PHP-8.0'
* PHP-8.0:
  imagecolorsforindex() cannot return false
2021-08-26 16:37:05 +02:00
Nikita Popov
cba166469d imagecolorsforindex() cannot return false 2021-08-26 16:36:27 +02:00
Ben Morss
eb6c9eb936
Lossless conversion for webp
Propagating lossless conversion from libgd to our bundled gd.
Changing "quantization" to "quality" as in libgd.
Adding test.

IMG_WEBP_LOSSLESS is only defined, if lossless WebP encoding is
supported by the libgd used.

Closes GH-7348.
2021-08-12 23:19:13 +02:00
Ben Morss
e0e2e9a547
Disable strict pixi requirement for libavif >= 0.9.1
Some AVIF image generators didn't include the PixelInformationProperty
(pixi), even though strictly speaking they should. In v0.9.2, libavif
began requiring this. Let's disable it so we can read those images too.

We also remove xfail from test on FreeBSD.

Closes GH-7253.
2021-08-06 20:24:59 +02:00
Christoph M. Becker
c2b017a96d
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #51498: imagefilledellipse does not work for large circles
2021-08-03 16:22:22 +02:00
Christoph M. Becker
213ad544e4
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51498: imagefilledellipse does not work for large circles
2021-08-03 16:20:16 +02:00
Christoph M. Becker
c565555f03
Fix #51498: imagefilledellipse does not work for large circles
We backport the respective upstream fix[1].

[1] <ace7fd88dc>

Closes GH-7329.
2021-08-03 16:17:47 +02:00
Javier Eguiluz
70872dde94 Remove a redundant expression 2021-08-02 21:51:26 +02:00
Javier Eguiluz
7c9ac479eb Fix some mismatches in preprocessor directive comments 2021-08-02 11:18:36 +02:00
Andy Postnikov
bb9ef2bedb Backport libgd commit
Source - f6a111c632
Related to https://github.com/php/php-src/pull/5127#issuecomment-884032991
2021-07-22 09:57:41 +02:00
Joe Watkins
570d9b63e9
Not serializable flag permeation 2021-07-20 12:28:35 +02:00
Christoph M. Becker
e1285c4aa5
Deprecate $num_points parameter of image(open|filled)polygon
Cf. <https://wiki.php.net/rfc/deprecations_php_8_1#num_points_parameter_of_image_open_filled_polygon>.

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
Co-authored-by: George Peter Banyard <7906688+Girgias@users.noreply.github.com>

Closes GH-6789.
2021-07-14 10:56:24 +02:00
Nikita Popov
a09754b3d3 Temporarily disable imagecreatefromstring_avif.phpt on FreeBSD
This test recently started failing on Cirrus CI, possibly after
a libavif update.

Disable it until the issue has been investigated, to avoid an
always failing job.
2021-07-09 11:54:09 +02:00
Ben Morss
cee33bab16
AVIF support for getimagesize() and imagecreatefromstring()
Thanks to Joe Drago for help with the AVIF detection code.

Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7091.
2021-07-07 00:02:57 +02:00
Ben Morss
fea437af56 Reduce girl.avif by 4x
This will make tests much faster, since one of our tests involves lossless conversion.
2021-07-03 09:41:30 +02:00
Jan-E
0c89edac3a
Windows: allow GD ext without avif.dll
Closes GH-7200.
2021-06-30 23:01:09 +02:00
Nikita Popov
f172bb30be Regenerate stubs 2021-06-11 10:35:21 +02:00