Commit Graph

12821 Commits

Author SHA1 Message Date
Dharman
c93b461ad7 Fix bug #80837
The error needs to be reported on the statement, not the connection.
2021-03-15 14:38:09 +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
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
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
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
Felipe Pena
78b0a85de6 Update NEWS 2021-02-24 18:40:32 +00: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
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
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
6dd85f83f7 Fixed bug #80781
zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.
2021-02-22 09:36:43 +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
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
Derick Rethans
2d858fbfb1 Fixed dates 2021-02-16 11:31:34 +00:00
Derick Rethans
6d3d9104e6 PHP-7.4 is now 7.4.17-dev 2021-02-16 11:26:47 +00:00
Nikita Popov
64b1085464 Fixed bug #80747
If RSA key generation fails, actually report that failure.
2021-02-15 15:34:01 +01:00
Daniel Black
3646604203 Fix #78680: mysqlnd pam plugin missing terminating null
The PAM service requires the terminating null to be part
of the communication.

Tested with MariaDB-10.4(pam) and Percona Server 5.7.32(auth_pam_compat).

Also changed MySQL Enterprise test to the server side plugin, authentication_pam
as opposed to the client plugin mysql_clear_password.

Add additional check for pamtest user and pam service file as
all are required for the test.

More importantly, test result should actually succeed.

Thanks Geoff Montee for bug report.

Closes GH-78680.
2021-02-15 11:32:07 +01:00
Nikita Popov
c34c523467 Fixed bug #80719 2021-02-11 16:12:06 +01:00
Christoph M. Becker
ca7547c9e2 Fix #80706: mail(): Headers after Bcc headers may be ignored
We need to handle the case where a CRLF after a Bcc header is not the
beginning of a folding marker, because in that case the Bcc header was
not the last "thing".

Closes GH-6666.
2021-02-08 18:42:31 +01:00
Christoph M. Becker
3f8d21b922 Fix #74779: x() and y() truncating floats to integers
We must not use the locale dependent `atof()`, but instead use the
(hopefully) locale independent `zend_strtod()`, when converting string
representations of floating point numbers which are sent by the server.

Closes GH-6665.
2021-02-05 13:09:59 +01:00
Christoph M. Becker
1bb2a4f91c Fix #53467: Phar cannot compress large archives
When Phars are flushed, a new temporary file is created for each entry
which should be compressed, and the `compressed_filesize` is retrieved.
Afterwards, the Phar manifest is written, and only after that the files
are copied to the actual Phar.  So for each such entry there is an open
temp file, what easily exceeds the limit.

Therefore, we use a single temporary file for all entries, and store
the start offset in the otherwise unused `header_offset` member.  We
ensure that the `cfp` members are properly set to NULL even if flushing
fails, to avoid use after free scenarios.

This solution is based on a suggestion by @lserni[1].

Closes GH-6643.

[1] <https://github.com/box-project/box2/issues/80#issuecomment-77147371>
2021-02-03 11:22:37 +01:00
Christoph M. Becker
039ca4e219 7.3.28 is next 2021-02-02 17:01:55 +01:00
Christoph M. Becker
7e9479083d Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
We remove the arbitrary restriction to `INT_MAX`; it is superfluous on
32bit systems where `ZEND_LONG_MAX == INT_MAX` anyway, and not useful
on 64bit systems, where larger files should be readable, if the
`memory_limit` is large enough.

Closes GH-6648.
2021-02-01 12:57:40 +01:00
Stanislav Malyshev
3c939e3f69 Fix bug #80672 - Null Dereference in SoapClient 2021-01-31 21:15:23 -08:00
Remi Collet
aeb4f21549 NEWS 2021-01-28 16:25:35 +01:00
Christoph M. Becker
6a0b889f57 Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
The default encoding of filenames in a ZIP archive is IBM Code Page
437.  Phar, however, only supports UTF-8 filenames.  Therefore we have
to mark filenames as being stored in UTF-8 by setting the general
purpose bit 11 (the language encoding flag).

The effect of not setting this bit for non ASCII filenames can be seen
in popular tools like 7-Zip and UnZip, but not when extracting the
archives via ext/phar (which is agnostic to the filename encoding), or
via ext/zip (which guesses the encoding).  Thus we add a somewhat
brittle low-level test case.

Closes GH-6630.
2021-01-26 19:14:25 +01:00
Christoph M. Becker
61ed904cec Fix #75850: Unclear error message wrt. __halt_compiler() w/o semicolon
We add the failure reason to the error message.

Closes GH-6638.
2021-01-25 18:47:15 +01:00
Christoph M. Becker
6adfb8c962 Fix #80648: Fix for bug 79296 should be based on runtime version
Instead of checking for actually affected libzip versions, we now always
`ZIP_TRUNCATE` empty files unless `ZIP_RDONLY` is set.

Closes GH-6625.
2021-01-20 16:20:13 +01:00
Derick Rethans
a33d0c3aae Update NEWS and version 2021-01-19 14:58:38 +00:00
Derick Rethans
e8a89c49db Update NEWS for PHP 7.4.15RC1 2021-01-19 14:44:32 +00:00
Christoph M. Becker
68f5289e9e Fix #69279: Compressed ZIP Phar extractTo() creates garbage files
When extracting compressed files from an uncompressed Phar, we must not
use the direct file pointer, but rather get an uncompressed file
pointer.

We also add a test to show that deflated and stored entries are
properly extracted.

This also fixes #79912, which appears to be a duplicate of #69279.

Co-authored-by: Anna Filina <afilina@gmail.com>

Closes GH-6599.
2021-01-19 10:28:54 +01:00
Christoph M. Becker
38ad37ad43 Fix #80595: Resetting POSTFIELDS to empty array breaks request
This is mainly to work around https://github.com/curl/curl/issues/6455,
but not building the mime structure for empty hashtables is a general
performance optimization, so we do not restrict it to affected cURL
versions (7.56.0 to 7.75.0).

The minor change to bug79033.phpt is unexpected, but should not matter
in practice.

Closes GH-6606.
2021-01-18 10:57:56 +01:00
Christoph M. Becker
25103c37aa Revert "Fix #76813: Access violation near NULL on source operand"
This reverts commit 5e15c9c41f, since
re2c default rules are only available as of re2c 0.13.7.
2021-01-11 13:21:12 +01:00
Christoph M. Becker
d1b1c04398 Fix #77565: Incorrect locator detection in ZIP-based phars
We must not assume that the first end of central dir signature in a ZIP
archive actually designates the end of central directory record, since
the data in the archive may contain arbitrary byte patterns.  Thus, we
better search from the end of the data, what is also slightly more
efficient.

There is, however, no way to detect the end of central directory
signature by searching from the end of the ZIP archive with absolute
certainty, since the signature could be part of the trailing comment.
To mitigate, we check that the comment length fits to the found
position, but that might still not be the correct position in rare
cases.

Closes GH-6507.
2021-01-05 23:40:24 +01:00
Stanislav Malyshev
e65932060a [ci skip] Update NEWS 2021-01-04 01:46:32 -08:00
Stanislav Malyshev
65d7ade684 [ci skip] Fix order 2021-01-04 01:45:15 -08:00
Stanislav Malyshev
8967e66559 [ci skip] Unpdate NEWS 2021-01-04 01:43:45 -08:00
Adam Seitz
70dfbe0068 Fix #80384: limit read buffer size
In the case of a stream with no filters, php_stream_fill_read_buffer
only reads stream->chunk_size into the read buffer. If the stream has
filters attached, it could unnecessarily buffer a large amount of data.

With this change, php_stream_fill_read_buffer only proceeds until either
the requested size or stream->chunk_size is available in the read buffer.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6444.
2020-12-23 13:49:56 +01:00
Derick Rethans
b043759cb4 Fixed bug #80376 (last day of the month causes runway cpu usage) 2020-12-21 10:30:40 +00:00
Nikita Popov
bc166844e3 MySQLnd: Support cursors in store/get result
This fixes two related issues:

1. When a PS with cursor is used in store_result/get_result,
   perform a COM_FETCH with maximum number of rows rather than
   silently switching to an unbuffered result set (in the case of
   store_result) or erroring (in the case of get_result).
   In the future, we might want to make get_result unbuffered for
   PS with cursors, as using cursors with buffered result sets
   doesn't really make sense. Unlike store_result, get_result
   isn't very explicit about what kind of result set is desired.
2. If the client did not request a cursor, but the server reports
   that a cursor exists, ignore this and treat the PS as if it
   has no cursor (i.e. to not use COM_FETCH). It appears to be a
   server side bug that a cursor used inside an SP will be reported
   to the client, even though the client cannot use the cursor.

Fixes bug #64638, bug #72862, bug #77935.

Closes GH-6518.
2020-12-18 10:19:13 +01:00
Nikita Popov
315f3f8dc9 Fixed bug #67983
We need to check the BIT case first, otherwise it will get skipped
in INT_AND_FLOAT_NATIVE mode.
2020-12-16 10:52:27 +01:00
Nikita Popov
118ff03335 Fix bug #80523
Don't truncate the file length to unsigned int...

I have no idea whether that fully fixes the problem because the
process gets OOM killed before finishing, but at least the
immediate parse error is gone now.
2020-12-16 10:20:20 +01:00
Derick Rethans
078cdd8f76 Prepare for 7.4.15 2020-12-15 14:13:29 +00:00
Christoph M. Becker
a53d67ceac Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not
attempt to strip the trailing slash from an now empty directory name.

Closes GH-6508.
2020-12-15 11:44:53 +01:00
Christoph M. Becker
40d9e3ab86 7.3.27 is next 2020-12-15 11:28:01 +01:00
Jakub Zelenka
a221e17b41 Fix bug #69625: FPM returns 200 status on request without SCRIPT_FILENAME 2020-12-13 18:39:48 +00:00
Nikita Popov
e450621f5e Fixed bug #76815
When we receive an error while reading a result set, we should
assume that no more result sets are available. libmysqlclient
implements the same behavior.
2020-12-10 11:23:41 +01:00
Nikita Popov
4922049213 Fixed bug #71145
Consume any additional result sets when running INIT_COMMAND.
2020-12-10 10:28:10 +01:00
Nikita Popov
f3d5877845 Backport fix for bug #70066
Given the number of duplicates this bug report had, it seems
worthwhile to fix this on PHP-7.4 as well.

Cherry-pick of 106e7e4bca.
2020-12-10 09:58:47 +01:00
Nikita Popov
44b234a9bc Fixed bug #78154
Handle errors during next_result in exec.
2020-12-09 12:46:47 +01:00
Christoph M. Becker
20e75329f2 Fix #48725: Support for flushing in zlib stream
When `php_zlib_deflate_filter()` is called with `PSFS_FLAG_FLUSH_INC`
but without new buckets being available (e.g. because a user calls
`rewind()` after writing to the stream), we have to make sure that any
pending data are flushed.  This could basically be done like in the
attached patch[1], but that could cause unnessary flushes, which can be
harmful for compression, and adds unnecessary flush markers to the
stream.  Thus, we use the `php_zlib_filter_data.finished` field, which
has not been used for `zlib.deflate` filters, and properly keep track
of the need to flush.

[1] <https://bugs.php.net/patch-display.php?bug_id=48725&patch=zlib-filter-flush-fix.patch&revision=latest>

Closes GH-6019.
2020-12-08 12:23:24 +01:00
Christoph M. Becker
65f5573bc8 Fix #77069: stream filter loses final block of data
Reading from a stream may return greater than zero, but nonetheless the
stream's EOF flag may have been set.  We have to cater to this
condition by setting the close flag for filters.

We also have to cater to that change in the zlib.inflate filter:

If `inflate()` is called with flush mode `Z_FINISH`, but the output
buffer is not large enough to inflate all available data, it fails with
`Z_BUF_ERROR`.  However, `Z_BUF_ERROR` is not fatal; in fact, the zlib
manual states: "If deflate returns with Z_OK or Z_BUF_ERROR, this
function must be called again with Z_FINISH and more output space
(updated avail_out) but no more input data, until it returns with
Z_STREAM_END or an error."  Hence, we do so.

Closes GH-6001.
2020-12-08 11:47:49 +01:00
Nikita Popov
bd093ad861 Fixed bug #63185 2020-12-08 11:30:54 +01:00
Dharman
a83cc03c13 Fixed bug #80458
If there is no result set (e.g. for upsert queries), still allow
fetching to occur without error, i.e. treat it the same way as
an empty result set.

This normalizes behavior between native and emulated prepared
statements and addresses a regression in PHP 7.4.13.
2020-12-04 16:59:47 +01:00
Christoph M. Becker
8588ae7215 Fix #75102: PharData says invalid checksum for valid tar
Apparently, there are broken tarballs out there which are actually in
ustar format, but did not write the `ustar` marker.  Since popular tar
tools like GNU tar and 7zip have no issues dealing with such tarballs,
Phar should also be more resilient.

Thus, when the first checksum check of a tarball in (presumed) in old-
style format fails, we check whether the checksum would be suitable for
ustar format; if so, we treat the tarball as being in ustar format.

Closes GH-6479.
2020-12-04 13:02:29 +01:00
Nikita Popov
d6fcaf5da4 Fixed bug #80457
On x32 sizeof(size_t) != sizeof(zend_long), so we need to be
careful with sign extension here.

Patch by bruno dot premont at restena dot lu.
2020-12-02 11:26:10 +01:00
Christoph M. Becker
c283f53b24 Fix #73809: Phar Zip parse crash - mmap fail
Phar signatures practically are of limited size; for the MD5 and SHA
hashes the size is fixed (at most 64 bytes for SHA512); for OpenSSL
public keys there is no size limit in theory, but "64 KiB ought to be
good enough for anybody".  So we check for that limit, to avoid fatal
errors due to out of memory conditions.

Since it is neither possible to have the signature compressed in the
ZIP archive, nor is it possible to manually add a signature via Phar,
we use ZipArchive to create a suitable archive for the test on the fly.

Closes GH-6474.
2020-12-01 16:58:19 +01:00
Christoph M. Becker
5e15c9c41f Fix #76813: Access violation near NULL on source operand
We avoid `YYCURSOR` becoming `NULL` by initializing `YYMARKER`, and add
a default rule for `<NORMAL>` where we catch unexpected input.

We also fix the only superficially related issue regarding empty input
followed by `T_SEPARATOR` and command, which caused another segfault.

Closes GH-6464.
2020-11-30 12:29:24 +01:00
Nikita Popov
0f579fd7c8 Fixed bug #80368
We assume that usually LibreSSL supports everything OpenSSL 1.1 does.
In this instance, this is not the case.
2020-11-27 10:57:19 +01:00
Nikita Popov
5240f8391f Fixed bug #80425
Rename the methods in MessageFormatAdapter to make sure they don't
clash with anything defined by icu itself, which may be a problem
if icu is linked statically.
2020-11-27 10:02:00 +01:00
Nikita Popov
ea372e7463 Fix bug #80402: Don't strip -lpthread
The current behavior has been introduced 20 years ago in
f9e375f493 as part of a larger change.
It's not clear to me why special treatement of -lpthread is necessary
here.
2020-11-26 11:54:20 +01:00
Nikita Popov
2fb12be84c Fixed bug #80411
References to null-serializations are stored as null, and as such
are part of the reference count.

Reminds me that we really need to deprecate the mess that is
Serializable.
2020-11-25 17:23:42 +01:00
Nikita Popov
d016434ad3 Fixed bug #80393
Handle macos versions that don't start with 10.* in libtool.

Patch by kir dot morozov at gmail dot com.
2020-11-24 15:26:40 +01:00
Christoph M. Becker
39f95f5614 Fix #77961: finfo_open crafted magic parsing SIGABRT
libmagic may abort the running process, which is not desirable for PHP;
we raise a fatal error instead.

Closes GH-6437.
2020-11-24 14:01:15 +01:00
Christoph M. Becker
5f9c82d514 Fix #80366: Return Value of zend_fstat() not Checked
In the somewhat unlikely case that `zend_fstat()` fails, we must not
proceed executing the function, but return `false` instead.

Patch based on the patch contributed by sagpant at microsoft dot com.

Closes GH-6432.
2020-11-24 13:09:16 +01:00
Nikita Popov
fa713ec17b Fixed bug #80362: Running dtrace scripts can cause php to crash
Patch by al at coralnet dot name.
2020-11-24 13:01:51 +01:00
Christoph M. Becker
221345a013 Fix #77594: ob_tidyhandler is never reset
We reset to original INI value on request shutdown.

Closes GH-6425.
2020-11-22 14:02:29 +01:00
Christoph M. Becker
881e43a03c Fix #72964: White space not unfolded for CC/Bcc headers
`\r\n` does only terminate a header, if not followed by `\t` or ` `.
We have to cater to that when determining the end position of the
respective headers.

Closes GH-6420.
2020-11-19 19:25:03 +01:00
Christoph M. Becker
c2b1182879 Fix #80345: PHPIZE configuration has outdated PHP_RELEASE_VERSION
We must not redefine the version "constants" for phpize builds, because
these have already generated in phpize.js, from where we pass these
variables forward to configure.js.

We also add `PHP_EXTRA_VERSION` and `PHP_VERSION_STRING` to the files
for completeness.

Closes GH-6419.
2020-11-19 16:23:20 +01:00
Christoph M. Becker
78773890f6 Fix #74558: Can't rebind closure returned by Closure::fromCallable()
Failure to rebind such closures is not necessarily related to them
being created by `ReflectionFunctionAbstract::getClosure()`, so we fix
the error message.

Closes GH-6424.
2020-11-16 14:31:06 +01:00
Derick Rethans
c1f8dd4a33 PHP-7.4 is now for 7.4.14 2020-11-10 17:58:21 +00:00
Christoph M. Becker
b5ce6df0da 7.3.26 is next 2020-11-10 11:08:16 +01:00
Alexander M. Turek
8eaaabdd58 Fixed bug #80310: Support for icu4c 68.1.
On stable versions, bring back the TRUE/FALSE defines by defining
_U_DEFINE_TRUE_AND_FALSE.

Closes GH-6397.
2020-11-09 14:31:29 +01:00
Christoph M. Becker
00e41a10b8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:54:32 +01:00
Christoph M. Becker
2cab085bb3 Fix #80266: parse_url silently drops port number 0
As of commit 81b2f3e[1], `parse_url()` accepts URLs with a zero port,
but does not report that port, what is wrong in hindsight.

Since the port number is stored as `unsigned short` there is no way to
distinguish between port zero and no port.  For BC reasons, we thus
introduce `parse_url_ex2()` which accepts an output parameter that
allows that distinction, and use the new function to fix the behavior.

The introduction of `parse_url_ex2()` has been suggested by Nikita.

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

Closes GH-6399.
2020-11-04 14:53:19 +01:00
Christoph M. Becker
0123f75b5d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:39:42 +01:00
Christoph M. Becker
9690ded288 Fix #70461: disable md5 code when it is not supported in net-snmp
Patch contributed by Alexander Bergmann.

Closes GH-6389.
2020-11-02 11:36:26 +01:00
Dharman
b5481defe6 Fix bug #72413: Segfault with get_result and PS cursors
We cannot simply switch to use_result here, because the fetch_row
methods in get_result mode and in use_result/store_result mode
are different: In one case it accepts a statement, in the other
a return value zval. Thus, doing a switch to use_result results
in a segfault when trying to fetch a row.

Actually supporting get_result with cursors would require adding
cursor support in mysqlnd_result, not just mysqlnd_ps. That would
be a significant amount of effort and, given the age of the issue,
does not appear to be particularly likely to happen soon.

As such, we simply generate an error when using get_result()
with cursors, which is much better than causing a segfault.
Instead, parameter binding needs to be used.
2020-10-29 16:34:08 +01:00
Christoph M. Becker
bd6850a282 [ci skip] Fix NEWS order 2020-10-29 12:15:31 +01:00
Christoph M. Becker
133ac0151b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #44618: Fetching may rely on uninitialized data
2020-10-29 12:00:57 +01:00
Christoph M. Becker
c21e901ba7 Fix #44618: Fetching may rely on uninitialized data
Unless `SQLGetData()` returns `SQL_SUCCESS` or `SQL_SUCCESS_WITH_INFO`,
the `StrLen_or_IndPtr` output argument is not guaranteed to be properly
set.  Thus we handle retrieval failure other than `SQL_ERROR` by
yielding `false` for those column values and raising a warning.

Closes GH-6281.
2020-10-29 11:59:12 +01:00
Nikita Popov
a66d73db4b Fixed bug #65825
Set error_info when we fail to read a packet, instead of throwing
a warning. Additionally we also need to populate the right
error_info in rowp_read -- we'll later take the error from the
packet, not the connection.

No test case, as this is hard to reliably test. I'm using the
test case from:
https://github.com/php/php-src/pull/2131#issuecomment-538374838
2020-10-28 17:15:27 +01:00
Christoph M. Becker
f547412cba Fix #79177: FFI doesn't handle well PHP exceptions within callback
We have to error on unhandled exceptions in FFI callbacks, to avoid
passing back undefined values.

This has been discussed and agreed upon in a previous PR[1].

[1] <https://github.com/php/php-src/pull/5120>

Closes GH-6366.
2020-10-28 13:34:56 +01:00
Nikita Popov
68dcaa29d8 Fixed bug #66528
Report errors in commit, rollback and autocommit handlers.
2020-10-28 12:18:02 +01:00
Dmitry Stogov
68f80be9d1 Fixed run-time binding of preloaded dynamically declared function 2020-10-28 13:50:14 +03:00
Dharman
b03776adb5 Fix bug #79375
Make sure deadlock errors are properly propagated and reports in
a number of places in mysqli and PDO MySQL.

This also fixes a memory and a segfault that can occur under these
conditions.
2020-10-28 11:01:47 +01:00
Christoph M. Becker
7bc1c0cca8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80268: loadHTML() truncates at NUL bytes
2020-10-26 13:09:30 +01:00
Christoph M. Becker
6d2bc72530 Fix #80268: loadHTML() truncates at NUL bytes
libxml2 has no particular issues parsing HTML strings with NUL bytes;
these just cause truncation of the current text content, but parsing
continues generally.  Since `::loadHTMLFile()` already supports NUL
bytes, `::loadHTML()` should as well.

Note that this is different from XML, which does not allow any NUL
bytes.

Closes GH-6368.
2020-10-26 13:08:05 +01:00
Christoph M. Becker
f9ba2ca136 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #62474: com_event_sink crashes on certain arguments
2020-10-26 11:54:45 +01:00
Christoph M. Becker
7424bfc7ac Fix #62474: com_event_sink crashes on certain arguments
We have to make sure that the variant is of type `VT_DISPATCH` before
we access it as such.

Closes GH-6372.
2020-10-26 11:48:57 +01:00
Christoph M. Becker
ac2e9587fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80258: Windows Deduplication Enabled, randon permission errors
2020-10-26 11:21:52 +01:00
Christoph M. Becker
848e24f24d Fix #80258: Windows Deduplication Enabled, randon permission errors
A recent bug fix regarding symlinks claimed:

> After resolving reparse points, the path still may be a reparse
> point; in that case we have to resolve that reparse point as well.

While that is basically correct, some reparse points may point to
inaccessible system folders (e.g. `IO_REPARSE_TAG_DEDUP` points to
"\System Volume Information").  Since we don't know details about
arbitrary reparse points, and are mainly interested in nested symlinks,
we take a step back, and only resolve `IO_REPARSE_TAG_SYMLINK` for now.

Close GH-6354.
2020-10-26 11:21:14 +01:00
Christoph M. Becker
8b59e4e897 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
2020-10-26 11:05:22 +01:00
Christoph M. Becker
2be27074b6 Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
`ADD_EXTENSION_DEP()` relies on the `PHP_<extname>` config variables to
be set to `"yes"`, and since the standard and date extension are always
enabled, we define the respective variables uncoditionally.

Closes GH-6383.
2020-10-26 11:03:05 +01:00
George Peter Banyard
d5e2431884 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:05:07 +01:00
George Peter Banyard
12a09183b3 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:01:48 +01:00
Christoph M. Becker
4ef7be20ab Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80242: imap_mail_compose() segfaults for multipart with rfc822
2020-10-20 19:00:16 +02:00
Christoph M. Becker
315b95b065 Fix #80242: imap_mail_compose() segfaults for multipart with rfc822
libc-client expects `TYPEMESSAGE` with an explicit subtype of `RFC822`
to have a `nested.msg` (otherwise there will be a segfault during
free), but not to have any `contents.text.data` (this will leak
otherwise).

Closes GH-6345.
2020-10-20 18:58:45 +02:00
Christoph M. Becker
9cfd650697 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Properly fix #80220
2020-10-20 13:35:06 +02:00
Christoph M. Becker
7f3bdda29b Properly fix #80220
The original fix for that bug[1] broke the formerly working composition
of message/rfc822 messages, which results in a segfault when freeing
the message body now.  While `imap_mail_compose()` does not really
support composition of meaningful message/rfc822 messages (although
libc-client appears to support that), some code may still use this to
compose partial messages, and using string manipulation to create the
final message.

The point is that libc-client expects `TYPEMESSAGE` with an explicit
subtype of `RFC822` to have a `nested.msg` (otherwise there will be a
segfault during free), but not to have any `contents.text.data` (this
will leak otherwise).

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

Closes GH-6343.
2020-10-20 13:32:53 +02:00
twosee
d134c0ac05 Fix bug #79643: Invalid memory read when opcache.interned_strings_buffer is 0 2020-10-20 12:50:28 +02:00
Nikita Popov
750a74ed9c Fix bug #79983: Add support for OCB mode
OCB mode ciphers were already exposed to openssl_encrypt/decrypt,
but misbehaved, because they were not treated as AEAD ciphers.
From that perspective, OCB should be treated the same way as GCM.
In OpenSSL 1.1 the necessary controls were unified under
EVP_CTRL_AEAD_* (and OCB is only supported since OpenSSL 1.1).

Closes GH-6337.
2020-10-19 11:09:00 +02:00
Christoph M. Becker
7899ac4c14 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80239: imap_rfc822_write_address() leaks memory
2020-10-15 12:56:02 +02:00
Christoph M. Becker
5941b30bb8 Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
2020-10-15 12:54:53 +02:00
Christoph M. Becker
d9058b61fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64076: imap_sort() does not return FALSE on failure
2020-10-13 19:38:31 +02:00
Christoph M. Becker
db8bf0a9e0 Fix #64076: imap_sort() does not return FALSE on failure
If unsupported `$search_criteria` are passed to `imap_sort()`, the
function returns an empty array, but there is also an error on the
libc-client error stack ("Unknown search criterion: UNSUPPORTED
(errflg=2)").  If, on the other hand, unsupported `$criteria` or
unsupported `$flags` are passed, the function returns `false`.  We
solve this inconsistency by returning `false` for unsupported
`$search_criteria` as well.

Closes GH-6332.
2020-10-13 19:37:05 +02:00
Derick Rethans
8fd8a1b128 Prepare for 7.4.13 2020-10-13 12:28:58 +01:00
Christoph M. Becker
2d01a89ad1 7.3.25 is next 2020-10-13 09:52:46 +02:00
Christoph M. Becker
12fc8f66e7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80226: imap_sort() leaks sortpgm memory
2020-10-12 23:17:57 +02:00
Christoph M. Becker
8488c34fc6 Fix #80226: imap_sort() leaks sortpgm memory
We need to free what we have allocated.

Closes GH-6327.
2020-10-12 23:16:31 +02:00
Christoph M. Becker
216d6a024a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80216: imap_mail_compose() does not validate types/encodings
2020-10-12 16:28:52 +02:00
Christoph M. Becker
73e43b6e19 Fix #80216: imap_mail_compose() does not validate types/encodings
We need to check whether the given `type`s and `encoding`s are within
bounds to avoid segfaults and out-of-bound reads.

Closes GH-6323.
2020-10-12 16:27:49 +02:00
Christoph M. Becker
4a469c7e98 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
2020-10-12 15:09:30 +02:00
Christoph M. Becker
c1962e900a Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
We have to clean up even on failure.

Closes GH-6322.
2020-10-12 15:08:30 +02:00
Christoph M. Becker
acce991a37 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80220: imap_mail_compose() may leak memory
2020-10-12 13:32:40 +02:00
Christoph M. Becker
0d022ddf03 Fix #80220: imap_mail_compose() may leak memory
Unless `topbod` is of `TYPEMULTIPART`, `mail_free_body()` does not free
the `nested.part`; while we could do this ourselves, instead we just
ignore additional bodies in this case, i.e. we don't attach them in the
first place.

Closes GH-6321.
2020-10-12 13:31:30 +02:00
Christoph M. Becker
7940fb42ce Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80215: imap_mail_compose() may modify by-val parameters
2020-10-10 23:26:12 +02:00
Christoph M. Becker
62a2387a8d Fix #80215: imap_mail_compose() may modify by-val parameters
We separate the input arrays and all sub-arrays to avoid modification
of the passed parameters.

This should be rewritten to use `zend_string`s for the "master" branch.

Closes GH-6316.
2020-10-10 23:25:06 +02:00
Christoph M. Becker
b2b9e2e87e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80213: imap_mail_compose() segfaults on certain $bodies
2020-10-10 19:18:14 +02:00
Christoph M. Becker
8bee0fbd37 Fix #80213: imap_mail_compose() segfaults on certain $bodies
We have to cater to non-associative arrays where the key may be `NULL`;
we just skip these elements.

Closes GH-6315.
2020-10-10 19:17:13 +02:00
Nikita Popov
15443f8af4 Fixed bug #80186
Early exit in FE_RESET if get_properties() returns empty array,
as we cannot add HT iterators to zend_empty_array.
2020-10-09 16:56:08 +02:00
Christoph M. Becker
ff3878adeb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77040: tidyNode::isHtml() is completely broken
2020-10-07 17:48:12 +02:00
Christoph M. Becker
e68acd031d Fix #77040: tidyNode::isHtml() is completely broken
The documentation of `tidyNode::isHtml()` states that this method
"checks if a node is part of a HTML document".  That is, of course,
nonsense, since a tidyNode is "an HTML node in an HTML file, as
detected by tidy."

What this method is actually supposed to do is to check whether a node
is an element (unless it is the root element).  This has been broken by
commit d8eeb8e[1], which assumed that `enum TidyNodeType` would
represent flags of a bitmask, what it does not.

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

Closes GH-6290.
2020-10-07 17:43:56 +02:00
Nikita Popov
683c988493 Fixed bug #80194
We should strip NOPs from unreachable_free blocks as well, to make
sure that the free really is the first op.
2020-10-07 15:03:12 +02:00
Christoph M. Becker
9dddfbe755 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80185: jdtounix() fails after 2037
2020-10-07 13:25:11 +02:00
Christoph M. Becker
e857dfa7cc Fix #80185: jdtounix() fails after 2037
There is no such thing as the "end of the unix epoch", and if it was,
it would certainly not be 2037-10-11T02:00:00.  There is, however,
potential integer overflow which we need to avoid.

Closes GH-6288.
2020-10-07 13:23:50 +02:00
Nikita Popov
3b7c8bb973 Fix bug #80126
When performing an unlinked instanceof, we also need to consider
interfaces of parent classes, as they may not have been inherited
yet.
2020-10-06 16:33:14 +02:00
Christoph M. Becker
c6e7969f05 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #46050: odbc_next_result corrupts prepared resource
2020-10-05 17:47:35 +02:00
Christoph M. Becker
69ba81d183 Fix #46050: odbc_next_result corrupts prepared resource
When resetting the result's values, we also have to reset its numcols.
2020-10-05 17:46:37 +02:00
Matteo Beccati
7c48479f62 [ci skip] moved soap fix to 7.4.11
When committing I didn't notice that version had been just bumped
2020-10-02 09:33:50 +02:00
Matteo Beccati
1666cfcca0 [ci skip] moved soap fix to 7.3.23
When committing I didn't notice that version had been just bumped
2020-10-02 09:32:52 +02:00
Stanislav Malyshev
f20a2b4f3c [ci skip] Add 7.4.11 security fixes to NEWS 2020-09-29 10:13:38 -07:00
Stanislav Malyshev
ae95d06f68 [ci skip] Add 7.3.23 security fixes to NEWS 2020-09-29 10:09:33 -07:00
Christoph M. Becker
b87e43d931 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80152: odbc_execute() moves internal pointer of $params
2020-09-29 11:35:41 +02:00
Christoph M. Becker
bf5f07cc8b Fix #80152: odbc_execute() moves internal pointer of $params
As least intrusive fix, we separate the passed array argument.

Closes GH-6219.
2020-09-29 11:34:48 +02:00
Christoph M. Becker
e08f69194c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80150: Failure to fetch error message
2020-09-29 11:04:09 +02:00
Christoph M. Becker
df5efa2fcd Fix #80150: Failure to fetch error message
In case of statement related errors, we need to pass the respective
statement handle to `SQLError()`.

Closes GH-6217.
2020-09-29 11:02:51 +02:00
Christoph M. Becker
f1d8395c77 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer
2020-09-28 22:58:16 +02:00
Christoph M. Becker
6acfb79276 Fix #67465: NULL Pointer dereference in odbc_handle_preparer
We have to initialize `stmt->driver_data` before we use it.

Closes GH-6225.
2020-09-28 22:57:01 +02:00
Christoph M. Becker
1086e4ec88 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80147: BINARY strings may not be properly zero-terminated
2020-09-25 13:52:08 +02:00
Christoph M. Becker
a49555a9e1 Fix #80147: BINARY strings may not be properly zero-terminated
We have to manually ensure that all strings fetched from a data source
are zero-terminated.

Closes GH-6213.
2020-09-25 13:51:18 +02:00
Christoph M. Becker
901d022001 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78470: odbc_specialcolumns() no longer accepts $nullable
2020-09-24 12:16:54 +02:00
Christoph M. Becker
610e7d2c77 Fix #78470: odbc_specialcolumns() no longer accepts $nullable
It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.
2020-09-24 12:15:59 +02:00
Christoph M. Becker
a89ac98f15 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76735: Incorrect message in fopen on invalid mode
2020-09-23 10:54:59 +02:00
Christoph M. Becker
2576c57a51 Fix #76735: Incorrect message in fopen on invalid mode
We have to log errors in `stream_opener` callbacks to the wrapper's
error log, because otherwise we may pick up an unrelated `errno` or a
most generic message.

Closes GH-6187.
2020-09-23 10:54:06 +02:00
Christoph M. Becker
ff0f6c26c2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76943: Inconsistent stream_wrapper_restore() errors
2020-09-22 16:12:37 +02:00
Christoph M. Becker
5ed0602ec6 Fix #76943: Inconsistent stream_wrapper_restore() errors
If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

Closes GH-6183.
2020-09-22 16:11:35 +02:00
Christoph M. Becker
f445e9cb93 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79423: copy command is limited to size of file it can copy
2020-09-22 13:16:59 +02:00
Christoph M. Becker
4000780b3d Fix #79423: copy command is limited to size of file it can copy
Passing `NULL` as `lpFileSizeHigh` to `GetFileSize()` gives wrong
results for files larger than 0xFFFFFFFF bytes.  We fix this by using
`GetFileSizeEx()`, and let the mapping fail, if the file size is too
large for the architecture.

Closes GH-5319.
2020-09-22 13:15:07 +02:00
Christoph M. Becker
19c844594e Fix mmap copying
Instead of attempting to map large files into memory at once, we map
chunks of at most `PHP_STREAM_MMAP_MAX` bytes, and repeat that until we
hit the point where `php_stream_seek()` fails (see bug 54902), and copy
the rest of the file by reading and writing small chunks.

We also fix the mapping behavior for zero bytes on Windows, which did
not error (as with `mmap()`), but would have mapped the remaining file.
2020-09-21 16:07:57 +02:00
Christoph M. Becker
d27dc5c028 Fix #80118: Erroneous whitespace match with JIT only
We backport r1273[1] from PCRE2.

[1] <https://vcs.pcre.org/pcre2?revision=1273&view=revision>

Closes GH-6165.
2020-09-21 10:28:22 +02:00
Christoph M. Becker
105132bd6b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80114: parse_url does not accept URLs with port 0
2020-09-20 15:37:11 +02:00
Christoph M. Becker
81b2f3e5d9 Fix #80114: parse_url does not accept URLs with port 0
URIs with a 0 port are generally valid, so `parse_url()` should
recognize such URIs, but still report the port as missing.

Co-authored-by: twosee <twose@qq.com>

Closes GH-6152.
2020-09-20 15:34:45 +02:00
Nikita Popov
5e7c5a82a5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #80107: Handling of large compressed packets
  Bug #80107 Add test for mysqli_query() fails for ~16 MB long query when compression is enabled
2020-09-18 12:57:50 +02:00
Nikita Popov
ecd9c42f9e Fix bug #80107: Handling of large compressed packets
There's two layers of packet splitting going on. First, packets
need to be split into having a payload of exactly 2^24-1 bytes or
being the last packet. If the split packet has size between 2^24-5
and 2^24-1 bytes, the compressed packets also needs to be split,
though the choice of split doesn't matter here. I'm splitting off
the first 8192 bytes, as that's what I observe libmysqlclient to be
doing.
2020-09-18 12:55:44 +02:00
Christoph M. Becker
9f2d03952d Update to PCRE2 10.35
We also backport the fix for bug #79846, and add a test case for the
related bug #79363.
2020-09-17 14:07:05 +02:00
Christoph M. Becker
c3c76dbfb9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80115: mysqlnd.debug doesn't recognize absolute paths with slashes
2020-09-17 12:38:16 +02:00
Christoph M. Becker
efdbc3688b Fix #80115: mysqlnd.debug doesn't recognize absolute paths with slashes 2020-09-17 12:37:02 +02:00
Nikita Popov
9c136f10cd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #80083
2020-09-17 10:13:53 +02:00
Nikita Popov
a4f806aa79 Fixed bug #80083
Add db2_execute() to the list of functions accessing the local
scope. Ideally the API wouldn't do that, but it seems most
pragmatic to address this on the opcache side at this point.
2020-09-17 10:12:10 +02:00
Christoph M. Becker
edddddcea8 7.3.24 is next 2020-09-15 10:51:41 +02:00
Derick Rethans
4e794b7935 The next release here will be 7.4.12 2020-09-15 09:36:57 +01:00
Christoph M. Becker
e41867888a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80067: Omitting the port in bindto setting errors
2020-09-11 14:46:51 +02:00
Christoph M. Becker
dfb3a79914 Fix #80067: Omitting the port in bindto setting errors
A recent commit[1] which fixed a memory leak introduced a regression
regarding the formerly liberal handling of IP addresses to bind to.  We
fix this by reverting that commit, and fix the memory leak where it
actually occurs.  In other words, this fix is less intrusive than the
former fix.

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

Closes GH-6104.
2020-09-11 14:44:12 +02:00
Sammy Kaye Powers
1b5268265c
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
2020-09-09 12:36:51 -07:00
Sammy Kaye Powers
2d4aa1ef3d
Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
Modules may have changed after restart which can cause dangling pointers from custom opcode handlers in the second-level cache files. This fix includes the installed module names and versions in the accel_system_id hash as entropy. Closes GH-5836
2020-09-09 12:08:19 -07:00
Christoph M. Becker
e6b2a97cac Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #72941: Modifying bucket->data by-ref has no effect any longer
2020-09-08 18:08:38 +02:00
Christoph M. Becker
5dcb8f2f1c Fix #72941: Modifying bucket->data by-ref has no effect any longer
To match the PHP 5 behavior, we have to explicitly cater to `buffer` or
`data` being references.

Closes GH-6096.
2020-09-08 18:06:40 +02:00
Nikita Popov
d0d9c3a980 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #80077
2020-09-08 10:01:13 +02:00
Nikita Popov
07cb665515 Fixed bug #80077
Quoting from the bug report:

> The domain names passed to getmxrr() do not contain a trailing dot.
> DNS lookups which do not find records will (depending on the local
> resolver config) try again by adding the local domain to the end of
> the searched host/domain. In many environments there's an mx record
> for any subdomain of the local domain and the MX query will return
> a hit. But the test expects no hit. So the test fails when checking
> that "qa.php.net" does not have an MX record in DNS. In our local
> environment the resolver falls back to also check qa.php.net.kippdata.de
> which does have an MX record. Using "qa.php.net." instead of "qa.php.net"
> should fix this for everyone.
2020-09-08 10:00:49 +02:00
Nikita Popov
2dabc4c305 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #80049
2020-09-03 17:12:58 +02:00
Nikita Popov
46a49be6c8 Fixed bug #80049
Type checking may convert to refcounted values, so force freeing
of extra args.
2020-09-03 17:12:40 +02:00
Christoph M. Becker
2f4a2a9316 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80048: Bug #69100 has not been fixed for Windows
2020-09-03 15:45:33 +02:00
Christoph M. Becker
1848ccdae2 Fix #80048: Bug #69100 has not been fixed for Windows
We fix the erroneous length calculation on Windows, too.

Closes GH-6067.
2020-09-03 15:43:19 +02:00
Nikita Popov
8516434a56 Fixed bug #80046
We already protect against optimizing away loop frees in DFA pass,
but not in block pass.
2020-09-03 11:19:04 +02:00
Nikita Popov
dfaa4768d2 Fix bug #80037
If we're accessing an uninitialized typed property and __get is
defined, don't perform a read_property callback, as __get is
supposed to have no effect on uninitialized typed properties.
Usually it doesn't, but by-reference assignments cannot be
performed through read_property.

I'm deleting the test for bug #80039 again, as it doesn't really
make sense anymore with this fix.
2020-08-31 12:17:00 +02:00
Matteo Beccati
42b6b8a3ae Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
2020-08-31 11:08:26 +02:00
Matteo Beccati
44ade0e875 Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
Added new flags that allow skipping param_evt(s) that are not used by drivers,
in a backwards and forward compatible manner. Updated the pgsql, mysql, sqlite
and oci drivers to properly use the new flags. I've left out pdo_dblib, which
doesn't have a param_hook, and pdo_firebird, which seems to be using
PARAM_EVT_NORMALIZE in a wrong context (param type vs event type).
2020-08-31 11:03:03 +02:00
Christoph M. Becker
1ff981d7a6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64130: COM obj parameters passed by reference are not updated
2020-08-26 14:53:46 +02:00
Christoph M. Becker
5ff15e2651 Fix #64130: COM obj parameters passed by reference are not updated
`ITypeInfo_GetIDsOfNames()` is supposed to fail with `E_NOTIMPL` for
out-of-process servers, thus we should not remove the already available
typeinfo of the object in this case.

We also properly free the `byref_vals`.
2020-08-26 14:50:04 +02:00
Christoph M. Becker
6b6c2c003c Fix #79979: passing value to by-ref param via CUFA crashes
If a by-val send is not allowed, we must not do so.  Instead we wrap
the value in a temporary reference.

Closes GH-6000
2020-08-24 14:08:32 +02:00
Christoph M. Becker
5ab7b30cd6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79986: str_ireplace bug with diacritics characters
2020-08-24 11:09:38 +02:00
Christoph M. Becker
844a2dd6ac Fix #79986: str_ireplace bug with diacritics characters
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).

Closes GH-6007
2020-08-24 11:08:48 +02:00
Christoph M. Becker
10df94dd0e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80002: calc free space for new interned string is wrong
2020-08-24 11:04:03 +02:00
Christoph M. Becker
fcd26ffcc3 Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
2020-08-24 11:03:19 +02:00
Christoph M. Becker
81fffa86b2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80007: Potential type confusion in unixtojd() parameter parsing
2020-08-22 12:31:07 +02:00
Andy Postnikov
b2a33ab06b Fix #80007: Potential type confusion in unixtojd() parameter parsing
Also it fixes test on 32-bit armv7 and x86
- Test unixtojd() function : error conditions [ext/calendar/tests/unixtojd_error1.phpt]

Closes GH-6033
2020-08-22 12:30:04 +02:00
Matteo Beccati
3877172411 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #47021: SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked"
2020-08-18 18:27:26 +02:00
Matteo Beccati
f7c43b8c72 Fix #47021: SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked" 2020-08-18 18:10:39 +02:00
Christoph M. Becker
ff14b7adad 7.3.23 is next 2020-08-18 09:55:37 +02:00
Derick Rethans
499bf91cd0 Prepare for 7.4.11 2020-08-18 08:06:20 +01:00
Nikita Popov
8bda799d6f Fixed bug #79724 2020-08-13 17:25:51 +02:00
Nikita Popov
981af26d7b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
2020-08-11 17:13:28 +02:00
Ahmed Abdou
2fe2e5b48f Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
PDO driver constructors are throwing PdoException without setting
errorInfo, so create a new reusable function that throws exceptions
for PDO and will also set the errorInfo. Use this function in
pdo_mysql, pdo_sqlite, and pdo_pgsql.
2020-08-11 17:12:48 +02:00
Nikita Popov
5c5508698d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #75785 by attempt switching endianness on Maker's Note
2020-08-11 16:27:06 +02:00
Nawarian
2fa4ca95db Fix bug #75785 by attempt switching endianness on Maker's Note
Different manufacturer models may come with a
different endianness (motorola/intel) format. In
order to avoid a big refactor and a gigantic lookup
table, this commit simply attempts to switch the
endianness and proceed when values are acceptable.

Closes GH-5849.
2020-08-11 16:26:34 +02:00
Nikita Popov
4609ded082 Fixed bug #79917
op_arrays can be shared on two levels: Either the op_array is
completely shared, or it is distinct but shares all members
(apart from static_variables).

The the op_array is distinct, we need to make sure to properly
initialize the MAP_PTR structures.
2020-08-11 14:58:54 +02:00
Christoph M. Becker
183b853dc6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #48585: com_load_typelib holds reference, fails on second call
2020-08-11 11:28:07 +02:00
Christoph M. Becker
dc108feab8 Fix #48585: com_load_typelib holds reference, fails on second call
Whether the type library is cached is actually irrelevant here; what
matters is that the symbols are imported, and since these are not
cached, we have to import them for every request.  And we cannot cache
the symbols, because the import depends on the current codepage, but
the codepage is a `PHP_INI_ALL` setting.
2020-08-11 11:26:50 +02:00
Nikita Popov
66d9f4d985 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79951
2020-08-11 10:35:25 +02:00
Nikita Popov
9d9dffe60a Fixed bug #79951
One branch did not release tmp_replace_entry_str.

Also reduce the scope of some variables.
2020-08-11 10:33:59 +02:00