1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Commit Graph

2043 Commits

Author SHA1 Message Date
Nikita Popov a1e2c8870e Merge branch 'PHP-7.4' 2019-07-22 17:26:01 +02:00
Nikita Popov d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Remi Collet 92d6720dcf Merge branch 'PHP-7.4'
* PHP-7.4:
  cleanup gd build with system libgd - drop need to use libpng with system libgd - drop need to use libjpeg with system libgd - drop need to use libXpm with system libgd - drop need to use libfreetype with system libgd - improve configure comments
2019-07-22 16:14:36 +02:00
Remi Collet 31d85b8417 cleanup gd build with system libgd - drop need to use libpng with system libgd - drop need to use libjpeg with system libgd - drop need to use libXpm with system libgd - drop need to use libfreetype with system libgd - improve configure comments 2019-07-22 16:14:19 +02:00
Christoph M. Becker ea2b8122e6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove superfluous HAVE_GD_BUNDLED checks
2019-07-22 16:00:18 +02:00
Christoph M. Becker f8202b5513 Remove superfluous HAVE_GD_BUNDLED checks
If we're compiling the bundled libgd, `HAVE_GD_BUNDLED` is set, so
there is no need to check for this macro again.
2019-07-22 15:59:44 +02:00
Christoph M. Becker ebe91a0066 Merge branch 'PHP-7.4'
* PHP-7.4:
  Drop superfluous ENABLE_GD_TTF
2019-07-22 12:01:58 +02:00
Christoph M. Becker d3d3404db7 Drop superfluous ENABLE_GD_TTF
If we `HAVE_LIBFREETYPE`, we define `ENABLE_GD_TTF` if it is not
defined.  Therefore we can check for `HAVE_LIBFREETYPE` in the first
place.
2019-07-22 12:01:24 +02:00
Remi Collet 2db5dfd6fc Merge branch 'PHP-7.4'
* PHP-7.4:
  improve temporary fix for system libgd
2019-07-22 09:12:48 +02:00
Remi Collet fff6b18657 improve temporary fix for system libgd
- PHP_GD_PNG needed to set include path for png.h
- PHP_GD_JPEG needed to set include path for jpeglib.h
2019-07-22 09:11:32 +02:00
Remi Collet eba877de77 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78314 (missing freetype support/functions with external gd)
2019-07-20 07:57:26 +02:00
Remi Collet a85e4d5336 Fixed bug #78314 (missing freetype support/functions with external gd) 2019-07-20 07:57:13 +02:00
Nikita Popov e36118a5c5 Merge branch 'PHP-7.4' 2019-07-16 12:20:21 +02:00
Nikita Popov 290e520c03 Use ZEND_HASH_FOREACH APIs in a few more places 2019-07-16 12:20:16 +02:00
Peter Kokot cbefc538fa Merge branch 'PHP-7.4'
* PHP-7.4:
  Use e.g. instead of less common f.e. [ci skip]
2019-07-09 17:53:57 +02:00
Peter Kokot 48abed7fd8 Use e.g. instead of less common f.e. [ci skip] 2019-07-09 17:53:46 +02:00
Peter Kokot 1f9906ab5b Merge branch 'PHP-7.4'
* PHP-7.4:
  Update changelogs [ci skip]
  Remove HAVE_ERRNO_H from libgd
2019-06-28 20:14:29 +02:00
Peter Kokot a014e50513 Remove HAVE_ERRNO_H from libgd
The check for errno.h has been removed via
50b9ef8d94

Upstream libgd library is also patched via
https://github.com/libgd/libgd/commit/1e7f93922fb3adf9f131d7e94aa13386062ffe11
2019-06-28 20:02:11 +02:00
Christoph M. Becker 611c57eaf7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Properly shut down font cache mutex
2019-06-21 16:01:28 +02:00
Christoph M. Becker eec5d2a25f Properly shut down font cache mutex
Since the font cache mutex in set up in MINIT, we have to shut it down
in MSHUTDOWN.
2019-06-21 16:00:47 +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
Nikita Popov 452076de44 Merge branch 'PHP-7.4' 2019-06-19 17:27:29 +02:00
Nikita Popov 9b3b07cd26 Suppress shift UB in gd_itofx()
There doesn't seem to be a corresponding upstream fix for this.
2019-06-19 17:27:09 +02:00
Nikita Popov 6ae9c10534 Merge branch 'PHP-7.4' 2019-06-19 16:36:29 +02:00
Nikita Popov 88b603768f imageloadfont: Perform overflow check before calculation
Instead of afterwards...
2019-06-19 15:50:52 +02:00
Nikita Popov 2a9fc31021 Fix buffer underflow in gd_gif_in.c
This has been fixed upstream in
https://github.com/libgd/libgd/commit/939d49a3a9d1cbcd2a37cea9eac9f9e5e9f9de78.
2019-06-19 15:41:45 +02:00
Nikita Popov 3645292235 Merge branch 'PHP-7.4' 2019-06-19 15:09:39 +02:00
Nikita Popov ea97fc9c1f Fix shift UB in gd_io.c
This has already been fixed upstream in
https://github.com/libgd/libgd/commit/24d352576c024769d18113a28f3be03d54fa1e66
and
https://github.com/libgd/libgd/commit/772d0107a6b00a0d6d7191383fe984f8c018b48c.
2019-06-19 15:09:00 +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] <https://github.com/php/php-src/commit/be73ae31324f7f3294a9467c0646dba4324c78ef>
2019-06-13 14:33:41 +02:00
Christoph M. Becker 692673f6a4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add BMP support to PHP info
2019-06-13 13:07:30 +02:00
Christoph M. Becker 3c5bb06536 Add BMP support to PHP info 2019-06-13 13:07:01 +02:00
twosee 63171d88f2 Add do...while(0) for RETURN_* and ZVAL_* APIs
Closes GH-4255.
2019-06-12 16:17:16 +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
Joe Watkins 74a82ca91c Merge branch 'PHP-7.4'
* PHP-7.4:
  fix flaky gd tests
2019-06-12 07:58:56 +02:00
Joe Watkins 2dfa495311 fix flaky gd tests 2019-06-12 07:52:28 +02:00
Nikita Popov 466666c616 Merge branch 'PHP-7.4' 2019-06-11 17:12:33 +02:00
Nikita Popov e5411e17c7 Remove unused _setEdgePixel() and getPixelOverflowColorTC() functions 2019-06-11 16:59:12 +02:00
Nikita Popov 5c844c1d36 Fix fabs warning in gd_interpolation.c
Matches upstream code.
2019-06-11 16:57:24 +02:00
Nikita Popov 2290102172 Remove safeboolean use in gd_jpeg.c
This is a backport of
https://github.com/libgd/libgd/blob/e5502c7a3f1fe60536ec060f0211d97066c006ea/src/gd_jpeg.c.
2019-06-11 16:54:45 +02:00
Nikita Popov 0849a621fd Fix abs(long) warnings in gd.c
I'm fixing this using (int) casts instead of labs() because this is
what upstream GD does.
2019-06-11 16:50:25 +02:00
Nikita Popov a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov 1df8175b61 Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
2019-06-03 09:17:12 +02:00
Stanislav Malyshev ae436a2627 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix function name
2019-05-27 17:21:32 -07:00
Stanislav Malyshev 892a188fc9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix function name
2019-05-27 17:21:28 -07:00