Commit graph

57518 commits

Author SHA1 Message Date
Dmitry Stogov
3b377b51a2 Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage) 2021-03-10 16:03:47 +03:00
Christoph M. Becker
7931956805 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51903: simplexml_load_file() doesn't use HTTP headers
2021-03-08 15:15:59 +01:00
Christoph M. Becker
f901bec494 Fix #51903: simplexml_load_file() doesn't use HTTP headers
The `encoding` attribute of the XML declaration is optional; it is good
practice to use external encoding information where available if it is
missing.  Thus, we check for `charset` info of `Content-Type` headers,
and see whether the encoding is supported.

We cater to trailing parameters and quoted-strings, but not to escaped
backslashes and quotes in quoted-strings, since no known character
encoding contains these anyway.

Co-authored-by: Michael Wallner <mike@php.net>

Closes GH-6747.
2021-03-08 15:07:01 +01:00
Christoph M. Becker
3880b8785b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
2021-03-08 14:51:45 +01:00
manuel
5787f91c55 Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
Don't wait for further responses after a HTTP 101 (Switching Protocols) response

Closes GH-6730.
2021-03-08 14:36:31 +01:00
David Carlier
ae23852e41 Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition.
Closes GH-6738.
2021-03-05 16:44:08 +01:00
Christoph M. Becker
1c16749eaa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Print error code if CreateMutex() fails
2021-03-05 15:08:24 +01:00
Christoph M. Becker
e0e167e581 Print error code if CreateMutex() fails
This issue came up recently in a bug report[1]; without the error code,
users can barely guess why the function failed.

[1] <https://bugs.php.net/80812>

Closes GH-6745.
2021-03-05 15:06:18 +01:00
Dmitry Stogov
187ba4353a Fix ASAN warning (Zend/zend_string.h:165:2: runtime error: null pointer passed as argument 2 of memcpy(), which is declared to never be null) 2021-03-04 17:27:26 +03:00
Christoph M. Becker
4f478af16d Fix #80825: ZipArchive::isCompressionMethodSupported does not exist
`HAVE_METHOD_SUPPORTED` should have been defined after we updated to
libzip 1.7.1 months ago.
2021-03-03 22:56:42 +01:00
Christoph M. Becker
303a4ae44a Fix test wrt. server.inc changes 2021-03-03 12:04:06 +01:00
Christoph M. Becker
90b24401d6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78719: http wrapper silently ignores long Location headers
2021-03-03 10:47:51 +01:00
Christoph M. Becker
51e2015af3 Fix #78719: http wrapper silently ignores long Location headers
When opening HTTP streams, and reading the headers, we currently
discard header lines longer than `HTTP_HEADER_BLOCK_SIZE` (1024 bytes).
While this is not generally forbidden by RFC 7230, section 3.2.5, it
is not generally allowed either, since that may change the "message
framing or response semantics".

We thus fix this by allowing arbitrarily long header lines.

Closes GH-6720.
2021-03-03 10:45:25 +01:00
Dmitry Stogov
957cb13a49 Fixed bug #80802: (zend_jit_fetch_indirect_var assert failure with tracing JIT) 2021-03-01 23:57:20 +03:00
Christoph M. Becker
37c9728615 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80751: Comma in recipient name breaks email delivery
2021-03-01 18:50:11 +01:00
Christoph M. Becker
71297a254b Fix #80751: Comma in recipient name breaks email delivery
So far, `SendText()` simply separates potential email address lists at
any comma, disregarding that commas inside a quoted-string do not
delimit addresses.  We fix that by introducing an own variant of
`strtok_r()` which caters to quoted-strings.

We also make `FormatEmailAddress()` aware of quoted strings.

We do not cater to email address comments, and potentially other quirks
of RFC 5322 email addresses, but catering to quoted-strings is supposed
to solve almost all practical use cases.

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

Closes GH-6735.
2021-03-01 18:46:21 +01:00
Nikita Popov
e857936518 Fixed bug #80805
Handle missing result_var in binary_op_result_type.

(cherry picked from commit 8446e28275)
2021-03-01 15:13:15 +01:00
George Peter Banyard
1ee6aad248 Fix Bug #80800 imap_open() fails when the flags parameter includes CL_EXPUNGE
This also affected imap_reopen().
Add a supplementary test that the CL_EXPUNGE flag does have
the intended effect.

Closes GH-6732
2021-02-27 13:12:22 +00:00
Felipe Pena
8813f2e0c3 Merge branch 'PHP-7.4' into PHP-8.0 2021-02-25 20:54:24 +00:00
Felipe Pena
988c3f9659 Fix memleak on ReflectionFunction and ReflectionGenerator classes when calling __construct after instantiation 2021-02-25 20:53:14 +00:00
Remi Collet
18071aaa08 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  skip test with openssl < 1.1.0
2021-02-25 13:54:19 +01:00
Remi Collet
ae0585c98e skip test with openssl < 1.1.0
The test fails, but without any crash
(this test is designed to catch a crash)
2021-02-25 13:52:35 +01:00
David CARLIER
ddea5c0816 crc32 module, clang spurious warning removal.
Closes GH-6725.
2021-02-25 10:17:21 +01:00
Nikita Popov
f06efce387 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  mysqlnd pam fix test error message
2021-02-25 09:52:07 +01:00
Daniel Black
8309c04464 mysqlnd pam fix test error message
Closes GH-6727.
2021-02-25 09:51:51 +01:00
Nikita Popov
44ef32ff2c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix potential file collision in dom tests
2021-02-24 21:30:44 +01:00
Nikita Popov
766f827e26 Fix potential file collision in dom tests 2021-02-24 21:30:20 +01:00
Dmitry Stogov
b7fa5268e4 Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1) 2021-02-24 12:20:20 +03:00
Nikita Popov
79cf2c56d3 Fixed bug #80786
Don't use r0 as temporary register in math_double_long if it is
already used for a memory result.

This was already done in one branch, but not the other.
2021-02-23 10:22:00 +01:00
Christoph M. Becker
b418fe266d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75776: Flushing streams with compression filter is broken
2021-02-22 15:32:17 +01:00
Christoph M. Becker
963e50c8c4 Fix #75776: Flushing streams with compression filter is broken
First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between.  In that case, the compression is never finalized.  We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached.  This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

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

Closes GH-6703.
2021-02-22 15:28:46 +01:00
Christoph M. Becker
1d2bbce532 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
2021-02-22 14:34:21 +01:00
Christoph M. Becker
073b6ea818 Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
There is no good reason not to show the credits in text based SAPIs,
except for brevity.  Thus, we suppress the credits from `php -i`.

Closes GH-6710.
2021-02-22 14:31:51 +01:00
Christoph M. Becker
6dcd640f35 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80774: session_name() problem with backslash
2021-02-22 12:35:23 +01:00
Christoph M. Becker
d7c98ca1ac Fix #80774: session_name() problem with backslash
Since we do no longer URL decode cookie names[1], we must not URL
encode the session name.  We need to prevent broken Set-Cookie headers,
by rejecting names which contain invalid characters.

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

Closes GH-6711.
2021-02-22 12:32:56 +01:00
Nikita Popov
85ffe8dcdc Avoid signed integer overflow in substr()
Perform negation after the (size_t) cast rather than before,
so as to avoid a signed integer overflow for PHP_INT_MIN.

Fixes oss-fuzz #31069.
2021-02-18 10:34:54 +01:00
Christoph M. Becker
553a0c52b1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80763: msgfmt_format() does not accept DateTime references
2021-02-17 17:30:47 +01:00
Christoph M. Becker
84b6152842 Fix #80763: msgfmt_format() does not accept DateTime references
`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.
2021-02-17 17:26:48 +01:00
Dmitry Stogov
7f68a7afe6 Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts) 2021-02-17 11:51:13 +03:00
Dmitry Stogov
fad87a24da Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true) 2021-02-16 20:02:12 +03:00
Nikita Popov
edb9229b8b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle incomplete result set metadata more gracefully
2021-02-16 15:34:47 +01:00
Nikita Popov
9552cf6b84 Handle incomplete result set metadata more gracefully
Rather than segfaulting because sname is missing lateron, report
a FAIL here. As this indicates a server bug, the errors is reported
as an out of band warning, rather than a client error.

This fixes the PHP side of bug #80713.
2021-02-16 15:34:14 +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
cb9785add1 Fixed bug #80723
This fixes the issue just for the Socket class. Presumably we'll
want to do the same for other "resource" objects.
2021-02-16 12:33:50 +01:00
Nikita Popov
4fb8252186 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Suppress OpenSSL error on missing optional config
2021-02-16 10:12:42 +01:00
Nikita Popov
7566742754 Suppress OpenSSL error on missing optional config
openssl_pkey_new() fetches various options from the config file --
most of these are optional, and not specifying them is not an error
condition from the perspective of the user. Unfortunately, the
CONF_get_string() API pushes an error when accessing a key that
doesn't exist (_CONF_get_string does not, but that is presumably a
private API). This commit adds a helper php_openssl_conf_get_string()
that automatically clears the error in this case. I've found that
OpenSSL occasionally does the same thing internally:
22040fb790/apps/req.c (L515-L517)

Closes GH-6699.
2021-02-16 10:11:00 +01:00
Christoph M. Becker
afe17cc1b6 Adapt test case for libcurl 7.75.0+
libcurl 7.75.0 finally adds support for `gophers://`, i.e. gopher over
TLS.  The protocol is neither standardized, nor is the protocol
registered with IANA, but well, it is there and the test case should
cater to that.
2021-02-16 00:28:34 +01:00
Nikita Popov
f43097a2d7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80747
2021-02-15 15:34:21 +01:00
Nikita Popov
64b1085464 Fixed bug #80747
If RSA key generation fails, actually report that failure.
2021-02-15 15:34:01 +01:00
Nikita Popov
8b9dd0a301 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78680: mysqlnd pam plugin missing terminating null
2021-02-15 11:32:54 +01:00