Commit Graph

12876 Commits

Author SHA1 Message Date
Nikita Popov
9e3ba775b7 Fixed bug #72368
Generate a param count mismatch error even if the query contains
no placeholders.

Additionally we shouldn't HANDLE errors from pdo_parse_params,
which are always reported via raise_impl_error. Doing so results
in duplicate error messages.
2020-12-10 16:53:08 +01:00
Nikita Popov
15b51a215a Fixed bug #79131
When a driver reports an error during EVT_ALLOC (and some over EVTs),
make sure we handle it as usual, i.e. warn or throw.

This requires some adjustments in PDO PgSQL to stop manually doing
this through an impl error.

Unfortunately the PDO PgSQL error messages regress because of this,
as they now include a completely arbitrary error code. There doesn't
seem to be an ability to skip it right now.
2020-12-10 15:53:23 +01:00
Nikita Popov
288581fade Fixed bug #79872 by improving error message
The actual behavior here is correct, but the previous error
message was misleading, as neither fetchAll() nor buffered queries
would help in this situation. Instead it is necessary to consume
all rowsets, which can be done by either unsetting the statement
or calling closeCursor().
2020-12-10 11:46:29 +01:00
Nikita Popov
d63aedd173 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #76815
2020-12-10 11:24:19 +01: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
9b678bc4d5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #71145
2020-12-10 10:31:36 +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
106e7e4bca Fixed bug #70066
If we fall back to emulated prepared statements, destroy S->stmt,
so the code doesn't get confused about which mode we're in.
2020-12-09 17:24:30 +01:00
Nikita Popov
fcfa7fd06b Fixed bug #66878
Keep track of whether we have fully consumed all result sets,
either using nextRowset() calls or closeCursor() and skip the
attempt to consume remaining results sets during destruction in
that case.

Especiall if closeCursor() has been used, we really shouldn't
have this sort of cross-statement inference.
2020-12-09 16:38:22 +01:00
Nikita Popov
71b5f1446e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #78154
2020-12-09 12:47:34 +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
fb4bc0f9e5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #48725: Support for flushing in zlib stream
2020-12-08 12:24:49 +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
d6ae0f010e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77069: stream filter loses final block of data
2020-12-08 11:49:28 +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
bd72e4aa44 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #63185
2020-12-08 11:35:57 +01:00
Nikita Popov
bd093ad861 Fixed bug #63185 2020-12-08 11:30:54 +01:00
Dmitry Stogov
7971602574 Fixed bug #80480 (Segmentation fault with JIT enabled) 2020-12-07 13:28:37 +03:00
Nikita Popov
9dc42b4114 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80458
2020-12-04 17:00:51 +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
b52db133df Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75102: `PharData` says invalid checksum for valid tar
2020-12-04 13:04:33 +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
George Peter Banyard
426fe2f20c Standardize behaviour for int message number between functions 2020-12-03 17:43:08 +00:00
Nikita Popov
7a61984a2b Fixed bug #80462 2020-12-02 10:19:32 +01:00
Christoph M. Becker
83cf4aa13a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73809: Phar Zip parse crash - mmap fail
2020-12-01 17:00:27 +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
Dmitry Stogov
44475e70e2 Fixed bug #80447 (Strange out of memory error when running with JIT) 2020-12-01 16:46:41 +03:00
Dmitry Stogov
1674c96c0b Bug #80447 (Strange out of memory error when running with JIT) 2020-12-01 16:43:05 +03:00
Christoph M. Becker
f1d11c118d Fix #62004: SplFileObject: fgets after seek returns wrong line
As it is, `::seek(0)` sets the file pointer to the beginning of the
file, but `::seek($n)` where `$n > 0` sets the file pointer to the
beginning of the following line, having line `$n` already read into the
line buffer.  This is pretty inconsistent; we fix it by always seeking
to the beginning of the line.

We also add a test case for the duplicate bug #46569.

Closes GH-6434.
2020-11-30 16:03:37 +01:00
George Peter Banyard
0076b47326 Fix Bug #80438: imap_msgno() incorrectly warns and return false on valid UIDs in PHP 8.0.0
Checking for a valid Unique ID (UID) cannot use the convenience macro as they might
be larger than the message number which has for maximum value the total number of
current messages available in the mailbox.
2020-11-30 14:08:31 +00:00
George Peter Banyard
a55402d07c Rename XmlParser to XMLParser for consistency with XMLWriter/XMLReader 2020-11-30 14:08:31 +00:00
Christoph M. Becker
666833b238 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76813: Access violation near NULL on source operand
2020-11-30 12:33:13 +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
f4e1768e21 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80368
2020-11-27 10:58:34 +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
48ff654fb9 Fixed bug #80433
Use ZEND_STRTOL to allow leading zeros in opcache.jit option.
2020-11-27 10:51:57 +01:00
Nikita Popov
c61390cfb4 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80425
2020-11-27 10:03:21 +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
Christoph M. Becker
49e1ed1941 Fix bug number 2020-11-26 23:34:35 +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
4633e70ab1 Fixed bug #80377
Make sure the $PHP_THREAD_SAFETY variable is always available
when configuring extensions. It was previously available for
phpized extensions, but for in-tree builds it was being set
too late.

Then, use $PHP_THREAD_SAFETY instead of $enable_zts to check for
ZTS in bundled extensions, which makes sure these checks also
work for phpize builds.
2020-11-25 11:47:05 +01:00
Dmitry Stogov
7fc2a3e15e Revert "Fixed bug #80377"
This reverts commit fc26ad9b12.
2020-11-25 01:10:26 +03:00
Nikita Popov
fc26ad9b12 Fixed bug #80377
Use $PHP_THREAD_SAFETY instead of $enable_zts to check for ZTS.
This variable is also available for phpize builds, while enable_zts
is only present for in-tree builds.
2020-11-24 15:52:41 +01:00
Nikita Popov
ae6e56fb98 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80393
2020-11-24 15:27:43 +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
e589609b4c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77961: finfo_open crafted magic parsing SIGABRT
2020-11-24 14:06:53 +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
deb8b8190e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80366: Return Value of zend_fstat() not Checked
2020-11-24 13:10:35 +01:00