Commit graph

837 commits

Author SHA1 Message Date
Stanislav Malyshev
dedaf40d21 Merge branch 'PHP-8.1' into PHP-8.2 2022-10-23 18:49:30 -06: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
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
George Peter Banyard
1ad59b32c2 Update INI validator and displayers depending on INI type
Closes GH-9451
2022-09-06 10:33:34 +01:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
056e968c54
Declare ext/gd constants in stubs (#9180) 2022-07-30 15:18:06 +02:00
Christoph M. Becker
365537fd6d
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8848: imagecopyresized() error refers to the wrong argument
2022-06-23 15:22:28 +02: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
Remi Collet
baeba4b0d7
Merge branch 'PHP-8.1'
* PHP-8.1:
  add missing conditions
  fix [-Wstrict-prototypes] build warnings in ext/gd
2021-11-25 13:20:37 +01:00
Remi Collet
54f1f8cf2a
add missing conditions 2021-11-25 13:20:27 +01:00
Remi Collet
1241ec8c3f
fix [-Wstrict-prototypes] build warnings in ext/gd 2021-11-25 13:17:15 +01:00
Remi Collet
f566cba0bb
fix [-Wstrict-prototypes] build warnings in ext/gd 2021-11-25 13:17:07 +01:00
Remi Collet
7c0f2b4dc0
Merge branch 'PHP-8.1'
* PHP-8.1:
  add missing cond.
  Enable encoding detection for Polish text
2021-11-25 10:16:34 +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
73d5dd77c4
Merge branch 'PHP-8.1'
* PHP-8.1:
  fix gdImagePngCtxEx call with system libgd
2021-11-25 08:27:48 +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
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Remi Collet
b3646440b1
Don't rely on libgd unused constants 2021-09-13 14:48:13 +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
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
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
81f6d36c90 Add avif support to ext/gd
This backports avif support from upstream libgd into bundled libgd
and exposes the functionality through new imagecreatefromavif()
and imageavif() functions.

Closes GH-7026.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-06-10 12:32:30 +02:00
Christoph M. Becker
3f890635ae
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81032: GD install is affected by external libgd installation
2021-05-14 12:28:36 +02:00
Christoph M. Becker
c455f49a6a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81032: GD install is affected by external libgd installation
2021-05-14 12:26:40 +02:00
Flavio Heleno
28e7addb9d
Fix #81032: GD install is affected by external libgd installation
This PR replaces the bundled libgd includes from #include <foo.h> with
#include "foo.h" for gd-related headers to avoid including headers that
may be available in system directories instead of the expected local
headers.

Closes GH-6975.
2021-05-14 12:24:45 +02:00
George Peter Banyard
c40231afbf
Mark various functions with void arguments.
This fixes a bunch of [-Wstrict-prototypes] warning,
because in C func() and func(void) have different semantics.
2021-05-12 14:55:53 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
a6fc427b8c Use zend_string_equals() API instead of strcmp() in various places
Closes GH-6784
2021-03-17 16:36:23 +00:00
Nikita Popov
db538775e1 Merge branch 'PHP-8.0'
* PHP-8.0:
  Return bool from imageinterlace()
2021-03-17 15:06:46 +01:00
Nikita Popov
c17434429d Return bool from imageinterlace()
The function accepts a bool since PHP 8.0, so it should also return
a bool to keep things consistent.

Furthermore a null return from this functions is not possible.
2021-03-17 15:05:09 +01:00
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Nikita Popov
550aee0be3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Properly check imagegd() signature
  Make imagegd $file parameter nullable
2021-02-09 15:19:56 +01:00
Nikita Popov
57cb01a927 Properly check imagegd() signature
Unlike imagegd2(), this function only accepts two parameters,
so we should be checking for that.
2021-02-09 15:18:59 +01:00
Nikita Popov
838ae016d7 Make imagegd $file parameter nullable
It is explicitly documented to be nullable, and this matches other
functions like imagepng. It is also documented to accept a stream,
which it currently does not...
2021-02-09 15:15:20 +01:00
Máté Kocsis
98fb565c74
Generate class entries from stubs for another batch of extensions
Closes GH-6669
2021-02-08 19:53:55 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
ecb1592ea6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't throw from imagecreatefromstring() with too short string
2020-12-02 10:55:45 +01:00
Nikita Popov
a89aaf6c38 Don't throw from imagecreatefromstring() with too short string
If the string is too short, we should treat this the same way as
an unrecognized image type. This function should be usable to
determine whether something is a valid image without doing any
checks beforehand.
2020-12-02 10:51:55 +01:00
Nikita Popov
38b3d43035 Fix zpp for GdFont|int
Use Z_PARAM_OBJ_OF_TYPE_OR_LONG to get standard behavior.
2020-10-22 15:07:01 +02:00
Nikita Popov
9d974aa1dd Don't allow properties on former resource objects 2020-10-22 10:37:16 +02:00
Nikita Popov
909468b3e6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't allow properties on GdImage
2020-10-22 10:34:44 +02:00
Nikita Popov
dd3639341d Don't allow properties on GdImage
Just like all the other former resources... we missed this case.
2020-10-22 10:34:14 +02:00
Sara Golemon
bc40bce868 Convert gdFont from resource to object 2020-10-21 23:41:41 +00:00