1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Commit Graph

618 Commits

Author SHA1 Message Date
Máté Kocsis
50765075db Improve some ValueError messages
Closes GH-5340
2020-04-06 10:41:01 +02:00
Máté Kocsis
b6229fbca2 Display nullability in type error messages for internal functions
Closes GH-5327
2020-03-31 16:55:36 +02:00
Máté Kocsis
01b266aac4 Improve error messages of various extensions
Closes GH-5278
2020-03-23 18:59:04 +01:00
Máté Kocsis
960318ed95 Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00
Máté Kocsis
ac0853eb26 Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis
99db00b1f2 Fix #78880 Another round 2020-01-19 18:28:43 +01:00
Máté Kocsis
d1764ca330 Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
afdaa91170 Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Christoph M. Becker
03bd4333f6 Add imagegetinterpolation()
While `imagesetinterpolation()` is available as of PHP 5.5.0,
there is no according getter function, so users would have to track the
current interpolation method manually.

To remedy this, we introduce `imagegetinterpolation()` as thin wrapper
for `gdImageGetInterpolationMethod()` (which has been introduced with
libgd 2.1.1), and use `im->interpolation_id` as fallback for older
libgd.  Since our bundled libgd does not yet have this function, we add
it.

We also simplify the recently introduced bug79068.phpt, where it is
sufficient to check that the interpolation method has not been changed.
2020-01-14 18:25:27 +01:00
Christoph M. Becker
5c51a482c9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79068: gdTransformAffineCopy() changes interpolation method
2020-01-06 10:39:00 +01:00
Christoph M. Becker
74b11e3315 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79068: gdTransformAffineCopy() changes interpolation method
2020-01-06 10:38:22 +01:00
Christoph M. Becker
4bec59f175 Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<9088591eae>.
2020-01-06 10:36:48 +01:00
Christoph M. Becker
bc04d5e9fc Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79067: gdTransformAffineCopy() may use unitialized values
2020-01-06 09:38:19 +01:00
Christoph M. Becker
f799f42ec8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79067: gdTransformAffineCopy() may use unitialized values
2020-01-06 09:37:40 +01:00
Christoph M. Becker
2c5860517c Fix #79067: gdTransformAffineCopy() may use unitialized values
We port
<7a06c1669c>.
2020-01-06 09:35:13 +01:00
Christoph M. Becker
2ede8db1b4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78923: Artifacts when convoluting image with transparency
2019-12-07 12:09:16 +01:00
Christoph M. Becker
aba070e630 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78923: Artifacts when convoluting image with transparency
2019-12-07 12:08:30 +01:00
willson-chen
b5d2cbe027 Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it.

Fix ported from <https://github.com/libgd/libgd/pull/559>.
2019-12-07 12:06:33 +01:00
Christoph M. Becker
2de79f0855 Make the $num_points parameter of php_imagepolygon optional
That parameter is mostly useless in practise, and likely has been
directly ported from the underlying `gdImagePolygon()` and friends,
which require that parameter since the number of elements of the point
array would otherwise be unknown.  Typical usages of `imagepolygon()`,
`imageopenpolygon()` and `imagefilledpolygon()` pass `count($points)/2`
or hard-code this value as literal.  Since explicitly specifying this
parameter is annoying and error-prone, we offer the possibility to omit
it, in which case the `$points` array must have an even number of
elements, and the number of points is calculated as `count($points)/2`.
2019-11-15 09:41:10 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Christoph M. Becker
7d96dcac2c Fix #55005: imagepolygon num_points requirement
We actually have to check `$num_points` instead of `2*count($points)`,
because the latter may be greater than the former, but not all elements
of `$points` are guaranteed to be used.  This allowed to pass arrays
with excess elements to draw polygons with less than three vertices.

While the current implementation of `gdImagePolygon()` and friends
would allow us to draw monogons and digons, we don't allow that
anymore, because the respective drawing primitives work slightly
different (e.g. drawing lines support anti-aliasing, but drawing
general polygons does not).

To minimize the BC break, we do not fix this longstanding issue for PHP
7, but target PHP 8 only.
2019-11-02 14:05:01 +01:00
Christoph M. Becker
76179cdf3d Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing skip keyword in tests
  Update NEWS for 7.4.0RC4
  Update NEWS for PHP 7.4.0RC3
2019-10-01 11:19:43 +02:00
Christoph M. Becker
73f29a5c5e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing skip keyword in tests
2019-10-01 11:17:53 +02:00
Christoph M. Becker
2fc5d00afa Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add missing skip keyword in tests
2019-10-01 11:15:12 +02:00
Fabien Villepinte
209e37db7d Add missing skip keyword in tests 2019-10-01 11:13:36 +02:00
Nikita Popov
235983dfde Merge branch 'PHP-7.4' 2019-09-30 17:52:39 +02:00
Fabien Villepinte
0aa3acc6c4 Fix borked SKIPIFs 2019-09-30 17:51:41 +02:00
Mark
8aad466c42 Convert GD Resources to objects 2019-09-30 15:14:02 +02:00
Christoph M. Becker
4f4074328c Prefer ValueError over Error in GD
Cf. <https://github.com/php/php-src/pull/4682>.
2019-09-10 12:37:42 +02:00
Peter Cowburn
a43679632b raise ValueError from imagecreate/imagecreatetruecolor
Raise a ValueError instead of a plain Error when calling imagecreate()
or imagecreatetruecolor() with too big or small values for the width or
height arguments.
2019-09-09 21:06:00 +01:00
Mark
5af8361060 Warnings to Errors: imagesetstyle 2019-09-04 15:21:59 +02:00
Mark
4a1f0eb9d3 Warnings to errors in imageaffinematrix*() 2019-09-04 15:18:07 +02:00
Mark
06a3dd536d Warnings to errors in imagecrop(auto) 2019-09-04 15:12:04 +02:00
Mark
d1f9ab11b3 Warnings to errors imageconvolution 2019-09-04 12:42:17 +02:00
Mark
34865f54e7 Warnings become errors for imagepolygon et al 2019-09-04 12:35:48 +02:00
Mark
87dbb32246 Negative checks for gamma 2019-09-04 12:31:01 +02:00
Mark
af8ecb39ae Warnings for image colour range check now throw exceptions 2019-09-04 12:27:08 +02:00
Mark
6c6c109e24 Warnings to errors for imagecreatefromgd2part
We also delete tests which were duplicates of a completely unrelated
test.
2019-09-04 12:22:27 +02:00
Mark
6a05e42459 Warnings to Errors imagetruecolortopalette 2019-09-04 12:14:34 +02:00
Mark
fde52e8a2c Warnings to Errors imagecreate(truecolor)
We also add a test helper which we will be using for other GD functions
as well.
2019-09-04 12:09:07 +02:00
Christoph M. Becker
7469d572f2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Support TGA reading
2019-06-20 23:41:23 +02:00
Christoph M. Becker
81fd113506 Support TGA reading
We add PHP bindings for libgd's features to read TGA files, which are
available as of libgd 2.1.0.

As PHP's bundled libgd doesn't yet include the respective features of the
external libgd, we add these.

Since TGA has no easily recognizable file signature, we don't add TGA
support for imagecreatefromstring() or getimagesize() and friends.
2019-06-20 23:40:51 +02:00
Nikita Popov
681136212f Merge branch 'PHP-7.4' 2019-06-20 10:16:31 +02:00
Nikita Popov
4488475a3e imagecolorallocate(): Check that RGB components are in-range
Instead of letting them bleed over into other components.
2019-06-20 10:09:54 +02:00
Christoph M. Becker
b994fd81cb Throw TypeError instead of warning in case of invalid path
For consistency with imagegd(), imagegd2() and imagexbm(), which throw
a TypeError if a path containing NUL bytes is given, we throw a
TypeError for the other image writer functions as well.
2019-06-13 22:37:50 +02:00
Christoph M. Becker
2018615c2a Remove superfluous CLEAN sections
These actually should have been removed with commit be73ae3[1].

[1] <be73ae3132>
2019-06-13 14:33:41 +02:00
Christoph M. Becker
fc7b3cc7ca Fix nullbyte tests
As of PHP 8.0.0, failing ZPP throws instead of issuing warnings, to
which we have to cater to.
2019-06-12 12:48:03 +02:00
Christoph M. Becker
be73ae3132 Merge branch 'PHP-7.4'
* PHP-7.4:
  Simplify GD null byte injection tests
2019-06-12 12:06:24 +02:00
Christoph M. Becker
37d0c7b0e4 Simplify GD null byte injection tests
These tests actually check that no file with a name containing a NUL is
created by the GD image output functions.  This is superfluous, since
it is sufficient to check that the function failed, and that an
appropriate warning has been raised.

We also add missing nullbyte injection tests.
2019-06-12 12:04:01 +02:00