Commit Graph

12728 Commits

Author SHA1 Message Date
Joe Watkins
bc59b046c6
Fix bug #81163 indirect vars in __sleep 2021-06-18 11:16:26 +02:00
Christoph M. Becker
2555efadbc
Fix #81145: copy() and stream_copy_to_stream() fail for +4GB files
When mapping the file, we need to pass the proper `dwFileOffsetHigh`
instead of `0`.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-7158.
2021-06-17 13:13:47 +02:00
Christoph M. Becker
0f1b17e378
Fix #72809: Locale::lookup() wrong result with canonicalize option
Canonicalization converts the locale to ICU format[1].  However, the
lookup described in RFC 4647, section 3.4, is about POSIX format.  To
make that lookup work for ICU format, we also need to cater to keyword
separators.

The results are somewhat unexpected, but apparently canonical lookup is
explicitly supposed to return canonical language tags[2].

[1] <https://unicode-org.github.io/icu/userguide/locale/#canonicalization>
[2] <https://github.com/php/php-src/blob/php-7.4.20/ext/intl/locale/locale_methods.c#L1504>

Closes GH-7151.
2021-06-16 10:33:59 +02:00
Derick Rethans
8370a084e4 Prepare for 7.4.22 2021-06-15 19:52:02 +01:00
Christoph M. Becker
a1738d8bd1
Fix #81092: fflush before stream_filter_remove corrupts stream
When doing a non finishing flush, BZ2_bzCompress() returns BZ_FLUSH_OK
(not BZ_FINISH_OK) what requires us to do further flushes right away.

We also refactor the while-loop as do-loop.

Closes GH-7113.
2021-06-08 15:36:37 +02:00
Peter van Dommelen
1b3b5c94e5 Fixed bug #81070
When the memory limit is reduced using an `ini_set("memory_limit", ..)`
below the currently allocated memory, the out-of-memory check overflowed.
Instead of implementing additional checks during allocation,
`zend_set_memory_limit()` now validates the new memory limit. When
below the current memory usage the ini_set call will fail and throw
a warning.

This is part of GH-7040.
2021-05-31 15:18:58 +02:00
Christoph M. Becker
7fd48264de
Fix #76694: native Windows cert verification uses CN as sever name
This is not guaranteed to work, since the actual server name may only
be given as SAN.  Since we're doing the peer verification later anyway
(using the respective context options as appropriate), there is no need
to even supply a server name when verifying against the Windows cert
store.

Closes GH-7060.
2021-05-31 14:35:17 +02:00
Nikita Popov
82f6f6da67 Fixed bug #81090
For concatenation, the in-place variant can be much more efficient,
because it will reallocate the string in-place. Special-case the
typed property compound assignment code for the case where we
concatenate to a string, in which case we know that the result
will also be a string, and we don't need the type check anyway.
2021-05-31 12:31:56 +02:00
Christoph M. Becker
ee9e07541f
Fix #76359: open_basedir bypass through adding ".."
We explicitly forbid adding paths with a leading `..` to `open_basedir`
at runtime.

Closes GH-7024.
2021-05-25 13:44:53 +02:00
Dimitry Andric
99a208566a Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
If ZTS is enabled, this can cause cwd_globals_ctor() to be called
multiple times, each with a freshly allocated virtual_cwd_globals
instance. At shutdown time however, cwd_globals_dtor() will call
realpath_cache_clean(), which then possibly cleans up the same
realpath_cache instance more than once. Using AddressSanitzer, this
shows up as a heap use-after-free.

To avoid this, add a helper function to do the actual work on one
instance of a realpath_cache, and call it both from cwd_globals_dtor()
and realpath_cache_clean(). The former uses the virtual_cwd_globals
parameter passed in via the destructor, the latter uses the CWDG()
macro.
2021-05-25 11:40:28 +02:00
Christoph M. Becker
36b9bdeeec
Fix #81048: phpinfo(INFO_VARIABLES) "Array to string conversion"
Now that we properly dereference references of the superglobals. we
also need to dereference contained references to avoid to string
conversion.

Closes GH-7014.
2021-05-19 14:07:15 +02:00
Derick Rethans
3938bfb564 The PHP 7.4 branch is now for 7.4.21 2021-05-18 13:44:01 +01:00
Graham Campbell
66c3a174f5
[ci skip] Removed incorrect news entry
Closes GH-7007.
2021-05-18 12:34:46 +02:00
Kamil Tekiela
ead72aabfb
Fix NEWS 2021-05-14 12:33:32 +01:00
Kamil Tekiela
6afbb74194
Fixed bug #81037 PDO discards error message text from prepared statement 2021-05-14 11:54:49 +01: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
Christoph M. Becker
23a3bbb468
Fix #44643: bound parameters ignore explicit type definitions
If `SQLDescribeParam()` fails for a parameter, we must not assume
`SQL_LONGVARCHAR` for any param which is not `PDO_PARAM_LOB`.  At least
mapping `PDO_PARAM_INT` to `SQL_INTEGER` should be safe, and not
introduce a BC break.

Closes GH-6973.
2021-05-12 13:30:51 +02:00
Petr Sumbera
04078a597c
php-fpm: fix Solaris port events.mechanism
Bug #65800
Fix by: rainer.jung@kippdata.de
2021-05-11 11:01:38 +02:00
Christoph M. Becker
57918b1a1b
Fix #80863: ZipArchive::extractTo() ignores references
We need to cater to references, when traversing the files to extract.
While we're at it, we move the `zval_file` declaration into a narrower
scope.

Closes GH-6959.
2021-05-07 19:15:29 +02:00
Nikita Popov
178bbe3478 Fixed bug #81015
Make sure that the previous opline is part of the same block,
otherwise it may be non-dominating.

The test case does not fail on PHP-7.4, but I think the general
problem can appear on 7.4 as well, so I'm applying the patch to
that branch.
2021-05-06 10:46:00 +02:00
Christoph M. Becker
0cafd53d18
Fix #81011: mb_convert_encoding removes references from arrays
We need to dereference references.

Closes GH-6938.
2021-05-04 18:37:40 +02:00
Derick Rethans
0328ff49cc Reset PHP-7.4 for 7.4.20 2021-05-04 12:18:27 +01:00
Christoph M. Becker
42c72ef463
Fix #79100: Wrong FTP error messages
First we need to properly clear the `inbuf`, what is an amendment to
commit d2881adcbc[1].

Then we need to report `php_pollfd_for_ms()` failures right away; just
setting `errno` does not really help, since at least in some cases it
would have been overwritten before we actually could check it.  We use
`php_socket_strerror()` to get a proper error message, and define
`ETIMEDOUT` to the proper value on Windows; otherwise we catch the
definition in errno.h, which is not compatible with WinSock.  The
proper solution for this issue would likely be to include something
like ext/sockets/windows_common.h.

Finally, we ensure that we only report warnings using `inbuf`, if it is
not empty.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d2881adcbc9be60de7e7d45a3316b0e11b7eb1e8>.

Closes GH-6718.
2021-05-03 15:19:57 +02:00
Christoph M. Becker
272df442f5
Fix #73246: XMLReader: encoding length not checked
libxml2 expects the passed encoding to be NUL terminated, so we reject
strings with NUL bytes right away.

Closes GH-6899.
2021-05-03 12:26:37 +02:00
Matteo Beccati
b8e49fe872
Revert "Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR"
This reverts commit 340a06778c.
2021-04-29 11:59:16 +02:00
Christoph M. Becker
7f83976200
Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
The `StrLen_or_IndPtr` parameter usually may be `SQL_NO_TOTAL`; we need
to cater to that possibility to avoid working with negative string
lengths and other issues.  A noteable exemption are calls to
`SQLGetData()` which return `SQL_SUCCESS`; in that case `SQL_NO_TOTAL`
can not occur.

Closes GH-6809.
2021-04-27 17:09:36 +02:00
Christoph M. Becker
12e15be921
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing NEWS entry for #80710
2021-04-27 13:41:20 +02:00
Christoph M. Becker
60a68a45c3
Add missing NEWS entry for #80710 2021-04-27 13:38:39 +02:00
Christoph M. Becker
c0ae3a7fb7
Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 15:07:08 +02:00
Christoph M. Becker
7f9183ce20
Fix typo in NEWS 2021-04-26 15:02:13 +02:00
George Peter Banyard
97f8ca52fa
Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6909
2021-04-26 13:22:12 +01:00
Christoph M. Becker
39ddf6b89c
Fix #67792: HTTP Authorization schemes are treated as case-sensitive
We use `zend_binary_strncasecmp()` to avoid any locale issues, and
refactor.  We also add a test case for Digest authentication.

Closes GH-6900.
2021-04-23 15:54:17 +02:00
Christoph M. Becker
1fcea24efb
Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
`php_stream_can_cast()` forwards to `_php_stream_cast()` with `ret` set
to `NULL`.  `php_pgsql_fd_cast()` needs to cater to that, because
otherwise the stream would report that it is not castable.

This *might* fix https://bugs.php.net/73903.

Closes GH-6888.
2021-04-20 18:29:12 +02:00
Christoph M. Becker
ea3c992bff
Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
twosee
c0b1bdcdc3
Fixed bug #80929
The function name should be kept if Closure was created from the function which is marked as ZEND_ACC_CALL_VIA_TRAMPOLINE, because it is not a one-time thing and it may be called multiple times.

Closes GH-6867.
2021-04-16 09:48:36 +08:00
twosee
7c6cf09463
Fixed bug #80900
SCCP optimization marks the wrong target feasible when the constant is of the incorrect type.

Closes GH-6861.
2021-04-14 00:07:32 +08:00
Christoph M. Becker
976e71a2fa
Fix #80933: SplFileObject::DROP_NEW_LINE is broken for NUL and CR
`buf` may contain NUL bytes, so we must not use `strcspn()` but rather
a binary safe variant.  However, we also must not detect a stray CR as
line ending, and since we only need to check line endings at the end
of the buffer, we can nicely optimize.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6836.
2021-04-13 16:49:06 +02:00
Derick Rethans
f99926f554 Put back inadvertedly removed NEWS entries 2021-04-13 11:48:50 +01:00
Derick Rethans
8e48895f48 Prepare for 7.4.19 2021-04-13 11:34:40 +01:00
Derick Rethans
d4f7e8cedc Prepare NEWS for 7.4.18RC1 2021-04-13 10:00:45 +01:00
Nikita Popov
a1fdfa700b Fixed bug #80950
Function info for curl_exec() incorrect specified that the
function cannot return true. This is already fixed in PHP 8,
as the func info entry was removed there.
2021-04-12 16:05:37 +02:00
Christoph M. Becker
0a36d417e8
Fix #79812: Potential integer overflow in pcntl_exec()
We use the proper type, and make sure that no overflow can occur by
using `safe_emalloc()` (we can assume that neither string length is
`SIZE_MAX`).

Closes GH-6845.
2021-04-12 12:12:40 +02:00
Matteo Beccati
340a06778c
Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR 2021-04-12 08:03:07 +02:00
Christoph M. Becker
9688071679
Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`,
we should not warn about this, because it is likely caused by the peer
having closed the connection without having sent a close_notify
shutdown alert.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6803.
2021-04-06 14:03:19 +02:00
Dmitry Stogov
39d8fc1edc Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
Old registers (r28/r29) might be clobbered by _restgpr routine used for return from C function compiled with -Os.
2021-03-31 13:10:21 +03:00
Rowan Tommins
206fd35a98
Handle reference zvals when outputting superglobals in phpinfo()
Fixes <https://bugs.php.net/80915>.

Closes GH-80915.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:49:22 +02:00
Christoph M. Becker
75cb678206
Fix #69668: SOAP special XML characters in namespace URIs not encoded
`xmlNewNs()` does not XML encode the passed `href`, so we need to do
that manually.

Closes GH-6804.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:17:55 +02:00
Christoph M. Becker
498eb8e052 Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.
2021-03-24 11:50:50 +01:00
Jakub Zelenka
538f95b1b7 Fix NEWS entry position for the latest FPM fix 2021-03-21 18:58:57 +00:00
Jakub Zelenka
c483b59124 Fix bug #80024: Duplication of info about inherited socket after pool removing 2021-03-21 18:52:07 +00:00