Commit Graph

115228 Commits

Author SHA1 Message Date
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
Nikita Popov
5acab7ebb4 filter_var_array() may return array_of_ref
This function preserves references in the input array.
2021-04-28 11:27:14 +02:00
Nikita Popov
67c4d1f5b9 fetch_assoc may return array_key_long
If the column name is a number (which is possible at least via
AS clauses), then symtable canonicalization will convert it into
an integer key.
2021-04-28 11:18:36 +02:00
Nikita Popov
c340f97ab0 password_get_info() may return array_of_null
The algo key is set to null if the algorithm can't be detected.
2021-04-28 10:54:31 +02:00
Nikita Popov
c7387ab92f getdate() may return array_key_long
This function mostly uses string keys, but the timestamp is
returned at key 0 (why???)
2021-04-28 10:46:37 +02:00
Nikita Popov
3f71ba2611 Remove incorrect format argument
rc is not used by the printf format.
2021-04-27 22:22:32 +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
66308af539
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.29 is next
2021-04-27 16:56:53 +02:00
Christoph M. Becker
98c8ad9218
7.3.29 is next 2021-04-27 16:55:20 +02:00
Christoph M. Becker
20b62ade29
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix ./makedist wrt. to GH move
2021-04-27 15:49:59 +02:00
Christoph M. Becker
096f148c61
Fix ./makedist wrt. to GH move
We can no longer export from git.php.net, and apparently exporting from
Github is not supported.  We apply a quick fix to export from the local
clone by default, still leaving an option to export from some other
repo.  This is, unfortunately, a minor BC break in a security release.

Co-authored-by: Remi Collet <remi@php.net>

Closes GH-6919.
2021-04-27 15:48:58 +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
Nikita Popov
310c0561a9 Fix build warning
This causes the build to fail on PHP-8.0 and higher.
2021-04-27 10:10:22 +02:00
Stanislav Malyshev
568df31698
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80710: imap_mail_compose() header injection
2021-04-26 21:48:16 -07:00
Christoph M. Becker
37962c61d2
Fix #80710: imap_mail_compose() header injection
Like `mail()` and `mb_send_mail()`, `imap_mail_compose()` must prevent
header injection.  For maximum backward compatibility, we still allow
header folding for general headers, and still accept trailing line
breaks for address lists.
2021-04-26 21:43:03 -07:00
Stanislav Malyshev
2b3346208a
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
2021-04-26 21:02:03 -07:00
Stanislav Malyshev
1b88c85cd8
Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
Sorry, this solution seems to have BC breaks, will need to look
for better one.

This reverts commit 9f7e8b777c.
2021-04-26 21:01:25 -07:00
Stanislav Malyshev
76637017ac
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement
2021-04-26 20:50:15 -07:00
Christoph M. Becker
9f7e8b777c
Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement
We ignore `XML_ENTITY_DECL` nodes when getting the hash of the
properties of a `SimpleXMLElement`.
2021-04-26 20:43:45 -07: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
a2771296c0
Export gzfwrite()
Extensions calling `gzfwrite()` cannot be built when linked against
php.dll (built with zlib support) otherwise.

Closes GH-6880.
2021-04-26 12:09:31 +02: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
David Rans
054fad6d63 PHPDBG: fix bug parsing 3-word opcodes
PHPDBG won't parse opcodes correctly if they are more than two words
separated by underscores (as many opcodes, like ZEND_POST_INC, are).

Now opcodes that have more than one underscore (e.g. ZEND_POST_INC) are
parsed correctly.

Closes GH-6895.
2021-04-22 10:11:26 +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
263f14ac60
Fix misleading error message
Closes GH-6889.
2021-04-20 15:41:42 +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
Christoph M. Becker
0071c7ed7e
Update php_version.h 2021-04-16 17:42:29 +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
David Carlier
5ccb5fd91e Fix return type of sparc atomic helper
Closes GH-6808.
2021-04-13 14:36:58 +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
David Carlier
a04fac84e7 Disable ifunc support on openbsd
Enabling it leads to segfault when resolvers are used e.g.
php_stripslashes.

Closes GH-6851.
2021-04-12 11:27:50 +02:00
fishmore
600402d986 Update zend_alloc.c
Don't free main thunk.  It will crash.
2021-04-12 09:28:24 +03: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
Matteo Beccati
da3a807f22
Increased test compatibility
The test expects no masked signals at the beginning, but when run as part
of a Bamboo build, SIGQUIT is already masked and the test fails.
2021-04-11 17:19:58 +02:00
Nikita Popov
454d297564 Fix gidlist allocation leak on error 2021-04-11 10:37:40 +02:00
Dmitry Stogov
7a8ffcec7d Fixed type inference for OP_DATA 2021-04-09 14:52:55 +03:00
Nikita Popov
29fa4d203a Don't mark non-refcounted phi as live
If the value is not refcounted, then it doesn't matter if the
FREE gets dropped.
2021-04-08 18:20:09 +02:00
Nikita Popov
0826a54836 Fix DCE of FREE of COALESCE
When encountering the following SSA graph:

    BB1:
    #2.T1 [string] = COALESCE #1.CV0($str) [null, string] BB2

    BB2:
    #5.T1 [string] = QM_ASSIGN string("")

    BB3:
    #7.X1 [string] = Phi(#2.X1 [string], #5.X1 [string])
    FREE #7.T1 [string]

We would currently determine that #7, #5 are dead, and eliminate
the FREE and QM_ASSIGN. However, we cannot eliminate #2, as
COALESCE is also responsible for control flow.

Fix this my marking all non-CV phis as live to start with. This
can be relaxed to check the kind of the source instruction, but
I couldn't immediately come up with a case where it would be
useful.
2021-04-08 17:01:13 +02:00