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
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
Nikita Popov
187efc6496
Fix null foreground in imagewbmp
...
The variable was not actually passed to zpp...
2020-10-14 16:40:35 +02:00
Nikita Popov
14a26db3e2
Update ext/gd parameter names
...
Closes GH-6308.
2020-10-09 17:10:11 +02:00
Nikita Popov
62c6d6952e
Add test instantiating all objects
...
Intended to find issues in opaque object destructors.
Closes GH-6251.
2020-10-01 18:37:24 +02:00
Nikita Popov
fb4554e431
Throw warning for failed object to int/float conversion
...
We previously couldn't increase the error level here because it
was coupled to comparison handling. This is no longer the case
in PHP 8.
2020-09-21 17:04:39 +02:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
...
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
c5401854fc
Run tidy
...
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Nikita Popov
7e339a335e
Make null byte error a ValueError
...
Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.
This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.
Closes GH-6094.
2020-09-08 15:23:23 +02:00
Máté Kocsis
628db3f3b5
Fix UNKNOWN default values in various extensions
...
Closes GH-6075
2020-09-07 19:02:02 +02:00
Christoph M. Becker
ecf4e7063d
Merge branch 'PHP-7.4' into master
...
* PHP-7.4:
Fix potential integer overflow detected by oss-fuzz
2020-08-24 17:38:50 +02:00
Christoph M. Becker
5dd1877ca1
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix potential integer overflow detected by oss-fuzz
2020-08-24 17:36:50 +02:00
Christoph M. Becker
74de17f2ea
Fix potential integer overflow detected by oss-fuzz
...
We port the respective fix from upstream[1].
[1] <9ed642764c
>
2020-08-24 17:35:04 +02:00
Máté Kocsis
4e6fbb0a12
Promote warnings to exceptions in ext/gd
...
Closes GH-6023
2020-08-20 12:07:04 +02:00
Máté Kocsis
2803c8fb8d
Add all the missing parameter types to stubs
...
Closes GH-5955
2020-08-13 14:47:18 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
...
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
d94d426f60
Fix the default value handling of imagegif()
2020-07-31 10:01:08 +02:00
Máté Kocsis
0d330e1a02
Add a few missing parameter types in stubs
...
Related to GH-5627
2020-07-30 14:26:45 +02:00
Máté Kocsis
ac0da090ae
Fix UNKNOWN default values in ext/mbstring and ext/gd
...
Closes GH-5598
2020-07-28 17:06:25 +02:00
Máté Kocsis
19bf66a9e4
Explode _php_image_output_ctx() into multiple functions
...
Closes GH-5844
2020-07-20 23:25:02 +02:00
Christoph M. Becker
340e2ead77
Export php_gd_libgdimageptr_from_zval_p()
...
Some extension may need to retrieve the `gdImagePtr` from an `GdImage`
object; thus, we export the respective function. To not being forced
to include gd.h in php_gd.h, we use the opaque `struct gdImageStruct *`
as return type.
We also rename php_gd2.dll to php_gd.dll, since there's not really much
point in giving the DLL a version number, since there is no php_gd.dll
for years (if there ever has been). Renaming, on the other hand,
matches the name on other systems (gd.so), and allows to actually use
`ADD_EXTENSION_DEP()`.
2020-07-11 19:33:20 +02:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
...
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
c1e792e1aa
Drop dead prototype
2020-07-10 10:23:19 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
...
Closes GH-5758
2020-07-06 21:13:34 +02:00
Fabien Villepinte
0c6d06ecfa
Replace EXPECTF when possible
...
Closes GH-5779
2020-06-29 21:31:44 +02:00
Máté Kocsis
b5c7a83dca
Remove unnecessary PHPDoc-alike blocks from tests
...
Closes GH-5759
2020-06-24 13:13:44 +02:00
Nikita Popov
c9b9f525a9
Include stub hash in generated arginfo files
...
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.
This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.
Closes GH-5739.
2020-06-24 09:55:19 +02:00
Nikita Popov
ca48129cae
Return void from php_jpeg_emit_message()
...
Instead of returning long and then casting to void.
This fixes a build warning on Ubuntu 20.04.
Closes GH-5742.
2020-06-19 16:59:29 +02:00
Christoph M. Becker
92c4b06513
Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0)
...
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds. This may be useful for other compilers as well.
[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019 >
2020-06-16 18:39:09 +02:00
Christoph M. Becker
b7a55aaff2
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix #79676 : imagescale adds black border with IMG_BICUBIC
2020-06-12 14:09:16 +02:00
Christoph M. Becker
ff7fd3dc85
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79676 : imagescale adds black border with IMG_BICUBIC
2020-06-12 14:07:43 +02:00
Christoph M. Becker
86e1f0ea11
Fix #79676 : imagescale adds black border with IMG_BICUBIC
...
We have to loop over all image pixels to avoid the black border. This
is also done in external libgd in `_gdScaleOneAxis` and `_gdScalePass`.
2020-06-12 14:05:54 +02:00
Christoph M. Becker
7f51f43509
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix #79615 : Wrong GIF header written in GD GIFEncode
2020-05-22 09:22:38 +02:00
Christoph M. Becker
da801ba5e3
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79615 : Wrong GIF header written in GD GIFEncode
2020-05-22 09:19:05 +02:00
Christoph M. Becker
d4bd6fb491
Fix #79615 : Wrong GIF header written in GD GIFEncode
...
The color resolution is expected in bits 4-6 of the packed fields byte
of the logical screen descriptor (byte 10 of the GIF data stream),
according to the specification[1], section 18.
[1] <https://www.w3.org/Graphics/GIF/spec-gif89a.txt >
2020-05-22 09:15:41 +02:00
George Peter Banyard
2f0dcf2ac2
Fix [-Wundef] warning in GD extension
2020-05-20 18:22:09 +02:00
Alex Dowad
8ddaf13ed3
Code tweaks: Remove unneeded semicolons
2020-04-29 23:17:40 +02:00
Remi Collet
ed179c2ef4
workaround typo in system libgd 2.3.0
2020-04-15 09:07:21 +02:00
Máté Kocsis
1f48feebb9
Improve some TypeError and ValueError messages
...
Closes GH-5377
2020-04-14 14:38:45 +02:00
Máté Kocsis
7b2a8a6dda
Lowercase NULL to null in stubs
2020-04-11 14:13:11 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
...
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Nikita Popov
3ea94ed78e
Fix typo in GD stub
2020-04-08 12:03:14 +02:00
Máté Kocsis
50765075db
Improve some ValueError messages
...
Closes GH-5340
2020-04-06 10:41:01 +02:00
Máté Kocsis
5322de1ba8
Generate functions entries from stubs for another set of extensions
...
Closes GH-5351
2020-04-05 00:59:44 +02:00
Nikita Popov
2bcc4ab8f4
Verify that all stubs have a return type
2020-04-03 17:59:30 +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
George Peter Banyard
ac89139773
Fix [-Wtype-limits] in bundled GD lib by using signed integers
...
As seen in the gdImageRotateBicubicFixed() function the same setup
occurs but it uses signed integers, therefore we use also use
signed integers in gdImageRotateBilinear()
Moreover, these two functions have been removed upstream in
bd6d2e101f
therefore we should also mimic upstream and remove them...
Thanks to @cmb69 for pointing it out.
2020-02-06 01:34:09 +01:00