Commit Graph

1531 Commits

Author SHA1 Message Date
Christoph M. Becker
82fa85fd08 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-12 13:27:57 +02:00
Christoph M. Becker
0cbf634657 Skip regression test for issue that has not yet been released in libgd
<https://github.com/libgd/libgd/issues/177> has been assessed as enhancement,
so most likely it will be released with GD 2.3.
2016-09-12 13:21:34 +02:00
Christoph M. Becker
c2044e60f3 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-12 12:39:14 +02:00
Christoph M. Becker
fcdc30b347 Skip test for external GD because of not yet published bugfix 2016-09-12 12:34:11 +02:00
Christoph M. Becker
c02cfd4e25 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-11 23:51:32 +02:00
Christoph M. Becker
6d0e773292 Skip tests for unpatched external libgd regarding libvpx
Some issues have never been fixed in the external libgd's libvpx binding,
so we skip the respective tests.
2016-09-11 23:49:09 +02:00
Christoph M. Becker
529811cfb0 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-11 19:32:54 +02:00
Christoph M. Becker
6ef987e012 Split test for bundled vs. external libgd
The behavior of imagecropauto($im, IMG_CROP_DEFAULT) is rather different
for the bundled and an external libgd, see
<https://github.com/libgd/libgd/issues/298>.
Therefore we split the test for now.
2016-09-11 19:30:55 +02:00
Christoph M. Becker
225478bccf Merge branch 'PHP-5.6' into PHP-7.0 2016-09-11 18:35:11 +02:00
Christoph M. Becker
38455293f7 Make test case more resilient
This test case fails with external libgd, because libgd < 2.2.4 converts
palette images to truecolor (<https://github.com/libgd/libgd/issues/297>).

However, even if there happens no truecolor conversion, it is not guaranteed
that the palette indexes of the original and the cropped image are identical
(this is, for instance, not the case with current libgd master where the bug
has been fixed). Therefore we check for the expected RGBA value instead of
the palette index.
2016-09-11 18:29:27 +02:00
Christoph M. Becker
cd16b64f01 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-11 13:26:30 +02:00
Christoph M. Becker
dc09f30933 A picture is worth a thousand message digests
The bundled GD test suites makes heavy use of md5() to verify the result
of drawing operations. This leads to fragile tests (even a slight change
in a PNG header would cause failure, and of course there is the
possibility of collisions), and even worse, eventual test failures are
rather unrevealing.

Therefore we replace all md5() verification with a simplistic
test_image_equals_file(), which is basically a simplified port of libgd's
gdTestImageCompareToFile(), adapted to the needs of PHPTs.

In the long run better tests helpers should be introduced (see also
<http://news.php.net/php.internals/94081>), but for now this solution
is preferable over the former.

(cherry picked from commit 24f9e96792)
2016-09-11 12:56:53 +02:00
Christoph M. Becker
8cc9570f53 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-03 19:59:44 +02:00
Christoph M. Becker
d582241368 Fix #67325: imagetruecolortopalette: white is duplicated in palette
gdImageTrueColorToPalette() is sometimes wasteful by putting multiple white
color entries into the palette. This is caused by an obvious typo, where
to avoid a division by zero when `total` is zero, `count` is checked instead
of `total`.

We fix this issue to improve the quality of the color quantization.

Cf. <https://github.com/libgd/libgd/commit/24b4550f>
2016-09-03 19:50:42 +02:00
Christoph M. Becker
0bc7e0c0ce Merge branch 'PHP-5.6' into PHP-7.0 2016-09-03 13:46:03 +02:00
Christoph M. Becker
bca913d70a Fix proto comment
While we're at it, we also change a related comment to use American English
consistently.
2016-09-03 13:41:29 +02:00
Christoph M. Becker
4c13a7f5c4 Merge branch 'PHP-5.6' into PHP-7.0 2016-08-21 19:48:38 +02:00
Christoph M. Becker
6a232c3604 Fix #68716: possible resource leaks in _php_image_convert()
We properly clean up after ourselves wrt. to closing opened file pointers
and created images.
2016-08-21 19:39:58 +02:00
Christoph M. Becker
4c68fc5392 Merge branch 'PHP-5.6' into PHP-7.0 2016-08-21 17:45:49 +02:00
Christoph M. Becker
d65adac2be Fix #72913: imagecopy() loses single-color transparency on palette images
The proper code to handle true-color to palette copies is already contained
in gdImageCopy(), so we can simply remove the buggy duplicated code.
2016-08-21 17:39:23 +02:00
Christoph M. Becker
7a36056d6c Merge branch 'PHP-5.6' into PHP-7.0 2016-08-21 16:15:22 +02:00
Christoph M. Becker
9eb5bbd8bd Fix #66005: imagecopy does not support 1bit transparency on truecolor images
We must not copy transparent pixels, see
<https://github.com/libgd/libgd/commit/daac285c>.
2016-08-21 16:08:57 +02:00
Christoph M. Becker
9fa0009702 Merge branch 'PHP-5.6' into PHP-7.0 2016-08-17 22:12:01 +02:00
Christoph M. Becker
54293d21cb Skip tests that are supposed to fail due to bugs in old external libgd 2016-08-17 21:36:26 +02:00
Christoph M. Becker
1bc9ea4f10 Merge branch 'PHP-5.6' into PHP-7.0 2016-08-17 18:13:41 +02:00
Christoph M. Becker
a3159d29bb Make tests a little more resilient
PNG allows identical images to be stored differently what makes nearly all
tests checking the MD5 hash of the PNG representation fail with external
libgd. For now, we use the GD format instead, which doesn't allow for such
differences.

Of course, this md5() checking should be replaced by a image diffing feature
in the long run.
2016-08-17 17:59:33 +02:00
Stanislav Malyshev
d8b2de164e fix tests 2016-08-16 22:55:43 -07:00
Stanislav Malyshev
1bd103df00 Fix bug #72730 - imagegammacorrect allows arbitrary write access 2016-08-16 22:55:40 -07:00
Stanislav Malyshev
a3598dd7c9 Fix bug#72697 - select_colors write out-of-bounds 2016-08-16 22:55:40 -07:00
Anatol Belski
d926a48fd2 fix tests 2016-08-16 14:41:24 +02:00
Anatol Belski
28022c9b1f Fix bug#72697 - select_colors write out-of-bounds
(cherry picked from commit b6f13a5ef9d6280cf984826a5de012a32c396cd4)

Conflicts:
	ext/gd/gd.c
2016-08-16 14:37:39 +02:00
Stanislav Malyshev
e70069a62f Fix bug #72730 - imagegammacorrect allows arbitrary write access
(cherry picked from commit 047fe0ed03093a496691d376fcf51a7e2f1d04b0)

Conflicts:
	ext/gd/gd.c
2016-08-16 14:14:03 +02:00
Anatol Belski
fad3f936ac fix ts build 2016-08-03 12:16:42 +02:00
Christoph M. Becker
3a8c027ec3 Merge branch 'PHP-5.6' into PHP-7.0 2016-08-02 18:49:59 +02:00
Christoph M. Becker
f5622f5c87 Fix #72709: imagesetstyle() causes OOB read for empty $styles
Calling imagesetstyle() with an empty $styles array caused gdImageSetStyle()
to be called with `noOfPixels==0`, what could have lead to OOB reads.
Actually, this issue will be fixed in libgd, but to avoid issues when older
libgd is in use, we simply disallow passing an empty $styles array to
imagesetstyle(), what wouldn't serve a useful purpose anyway.
2016-08-02 18:43:37 +02:00
Christoph M. Becker
138fea83fe Merge branch 'PHP-5.6' into PHP-7.0
# Resolved conflicts:
#	ext/gd/tests/gd_info_variation1.phpt
2016-07-25 02:02:54 +02:00
Christoph M. Becker
305bddb0ed Fix broken test case
d28f1da introduced a test regression, due to potentially additional output
regarding FreeType support. We fix that by making the test more resilient.
2016-07-25 02:00:37 +02:00
Christoph M. Becker
4db4997ac5 Merge branch 'PHP-5.6' into PHP-7.0
# Resolved conflicts:
#	ext/gd/tests/gd_info_variation1.phpt
2016-07-25 00:16:21 +02:00
Christoph M. Becker
d28f1dae9d Fix broken test case
The test claims that it would be "checking all the values in returned array",
but due to the use of %a it actually skipped elements. We fix that by using
%s instead.
2016-07-25 00:13:44 +02:00
Christoph M. Becker
2c0a18480d Merge branch 'PHP-5.6' into PHP-7.0 2016-07-23 19:36:53 +02:00
Christoph M. Becker
88838dd282 Fix #68712: suspicious if-else statements 2016-07-23 19:29:43 +02:00
Christoph M. Becker
03ccd42b18 Merge branch 'PHP-5.6' into PHP-7.0 2016-07-23 18:12:14 +02:00
Christoph M. Becker
9fbd0c1ff1 Fix copy&paste errors in gd_interpolation.c
According to <https://github.com/libgd/libgd/commit/f101380>.
2016-07-23 18:09:18 +02:00
Christoph M. Becker
5056d59f96 Merge branch 'PHP-5.6' into PHP-7.0 2016-07-23 16:55:16 +02:00
Christoph M. Becker
2c16b9cf62 Fix #66555: Always false condition in ext/gd/libgd/gdkanji.c
This issue has already been fixed in libgd[1], so we fix PHP's bundled
libgd accordingly.

[1] <https://github.com/libgd/libgd/commit/aa1d71c>
2016-07-23 16:48:07 +02:00
Stanislav Malyshev
df5ee7bc25 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Improve fix for #72520
  #72482, revert for 5.6 for now

Conflicts:
	ext/zip/zip_stream.c
2016-07-19 22:38:35 -07:00
Pierre Joye
e8b768dd92 Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6 2016-07-20 00:18:56 +07:00
Pierre Joye
9cc0a5a9a9 #72482, revert for 5.6 for now 2016-07-20 00:18:25 +07:00
Christoph M. Becker
8466155ff5 Merge branch 'PHP-5.6' into PHP-7.0 2016-07-19 17:41:16 +02:00
Christoph M. Becker
828f911efd Fix #43828: broken transparency of imagearc for truecolor in blendingmode
No pixel of a filled arc must ever be drawn multiple times. Otherwise we get
artifacts regarding transparency. That happens with the current
implementation of gdImageFilledArc() unless gdChord or gdNoFill are set.
When gdPie is set, however, the filled arc is drawn in wedges, which are
polygons of three points, and so some overlap is natural.

To resolve the issue, we stick with the current algorithm of calculating the
wedges, but instead of drawing each polygon separately, we put the relevant
points in a large array, and draw a single polygon. That also is supposed to
improve the performance considerably.

Note that this modification will change the results when gdImageSetStyle()
or gdImageSetBrush() are used, but we believe that this modification is also
an improvement in this regard, even though it still might not make much
sense to use these functions with gdImageFilledArc().

The respective fix for libgd is
<https://github.com/libgd/libgd/commit/e7e20d6>.
2016-07-19 17:38:26 +02:00