]> granicus.if.org Git - php/log
php
4 years agoFix the signature of FFI::sizeof() and FFI::alignof()
Máté Kocsis [Wed, 23 Dec 2020 22:27:12 +0000 (23:27 +0100)]
Fix the signature of FFI::sizeof() and FFI::alignof()

4 years agoFix PDO_OCI test
Christopher Jones [Thu, 24 Dec 2020 06:48:39 +0000 (17:48 +1100)]
Fix PDO_OCI test

4 years agoAdd regression test for bug #76770
Semen Dubina [Mon, 10 Sep 2018 22:26:02 +0000 (01:26 +0300)]
Add regression test for bug #76770

Closes GH-3514.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Wed, 23 Dec 2020 12:52:24 +0000 (13:52 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #80384: limit read buffer size

4 years agoFix #80384: limit read buffer size
Adam Seitz [Tue, 1 Dec 2020 23:40:16 +0000 (00:40 +0100)]
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.

4 years agoFixed bug #80376 (last day of the month causes runway cpu usage)
Derick Rethans [Mon, 21 Dec 2020 10:31:41 +0000 (10:31 +0000)]
Fixed bug #80376 (last day of the month causes runway cpu usage)

4 years agoFixed bug #80376 (last day of the month causes runway cpu usage)
Derick Rethans [Mon, 21 Dec 2020 10:30:40 +0000 (10:30 +0000)]
Fixed bug #80376 (last day of the month causes runway cpu usage)

4 years agoFix bug #80537
Nikita Popov [Mon, 21 Dec 2020 09:21:08 +0000 (10:21 +0100)]
Fix bug #80537

This is an unavoidable breaking change to both the type and
parameter name.

The assertion that was supposed to prevent this was overly lax
and accepted any object type for string parameters.

4 years agoDescription typo
Christopher Jones [Mon, 21 Dec 2020 04:46:26 +0000 (15:46 +1100)]
Description typo

4 years agoBundle PECL OCI8 3.0.1
Christopher Jones [Mon, 21 Dec 2020 04:15:16 +0000 (15:15 +1100)]
Bundle PECL OCI8 3.0.1

4 years agoRetrofit NEWS
Christopher Jones [Mon, 21 Dec 2020 04:07:40 +0000 (15:07 +1100)]
Retrofit NEWS

4 years agoRevert "DateTime:: and DateTimeImmutable::getTimestamp() may return false"
Christoph M. Becker [Sun, 20 Dec 2020 22:07:02 +0000 (23:07 +0100)]
Revert "DateTime:: and DateTimeImmutable::getTimestamp() may return false"

This reverts commit b67c23218950eae0a153b093dcefbe14b3b40901.

4 years agoDateTime:: and DateTimeImmutable::getTimestamp() may return false
Christoph M. Becker [Sun, 20 Dec 2020 18:32:12 +0000 (19:32 +0100)]
DateTime:: and DateTimeImmutable::getTimestamp() may return false

4 years agoFix ext/date stubs
Christoph M. Becker [Wed, 9 Dec 2020 15:51:53 +0000 (16:51 +0100)]
Fix ext/date stubs

Closes GH-6523.

4 years agoPDO MySQL: Handle boolean parameter binding with libmysql
Nikita Popov [Fri, 18 Sep 2020 15:46:42 +0000 (17:46 +0200)]
PDO MySQL: Handle boolean parameter binding with libmysql

Previously boolean parameters were simply silently ignored...

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 18 Dec 2020 09:20:13 +0000 (10:20 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  MySQLnd: Support cursors in store/get result

4 years agoMySQLnd: Support cursors in store/get result
Nikita Popov [Wed, 16 Dec 2020 11:12:06 +0000 (12:12 +0100)]
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.

4 years agoFix #80521: Parameters with underscores no longer recognized
Christoph M. Becker [Wed, 16 Dec 2020 19:02:45 +0000 (20:02 +0100)]
Fix #80521: Parameters with underscores no longer recognized

We have to use the proper value for the bitmask.

4 years agoDetect overlarge step for character range()
Nikita Popov [Wed, 16 Dec 2020 16:01:15 +0000 (17:01 +0100)]
Detect overlarge step for character range()

This was done for int and float ranges, but not char ranges.

Fixes oss-fuzz #28666.

4 years agoPDO MySQL: Use mysqlnd column names
Nikita Popov [Wed, 16 Dec 2020 14:17:13 +0000 (15:17 +0100)]
PDO MySQL: Use mysqlnd column names

mysqlnd already creates interned zend_strings for us, so let's
make use of them.

This also required updating the PDO case changing code to work
with potentially shared strings. For the lowercasing, use the
optimized zend_string_tolower() implementation.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 16 Dec 2020 09:53:48 +0000 (10:53 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #67983

4 years agoFixed bug #67983
Nikita Popov [Wed, 16 Dec 2020 09:52:27 +0000 (10:52 +0100)]
Fixed bug #67983

We need to check the BIT case first, otherwise it will get skipped
in INT_AND_FLOAT_NATIVE mode.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 16 Dec 2020 09:20:35 +0000 (10:20 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix bug #80523

4 years agoFix bug #80523
Nikita Popov [Wed, 16 Dec 2020 09:16:50 +0000 (10:16 +0100)]
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.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Derick Rethans [Tue, 15 Dec 2020 14:13:43 +0000 (14:13 +0000)]
Merge branch 'PHP-7.4' into PHP-8.0

4 years agoPrepare for 7.4.15
Derick Rethans [Tue, 15 Dec 2020 14:13:29 +0000 (14:13 +0000)]
Prepare for 7.4.15

4 years agoPrepare for PHP 8.0.2
Gabriel Caruso [Tue, 15 Dec 2020 14:03:21 +0000 (11:03 -0300)]
Prepare for PHP 8.0.2

This was missing from f1f78ac875fcfbf1347eb81eac06c11343c4a664.

4 years agoNext is 8.0.2
Gabriel Caruso [Tue, 15 Dec 2020 13:30:55 +0000 (10:30 -0300)]
Next is 8.0.2

4 years agoOptimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible.
Dmitry Stogov [Tue, 15 Dec 2020 11:30:58 +0000 (14:30 +0300)]
Optimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 15 Dec 2020 10:45:35 +0000 (11:45 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #77322: PharData::addEmptyDir('/') Possible integer overflow

4 years agoFix #77322: PharData::addEmptyDir('/') Possible integer overflow
Christoph M. Becker [Fri, 11 Dec 2020 15:47:42 +0000 (16:47 +0100)]
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.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 15 Dec 2020 10:32:10 +0000 (11:32 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  7.3.27 is next

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 15 Dec 2020 10:30:46 +0000 (11:30 +0100)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  7.3.27 is next

4 years ago7.3.27 is next
Christoph M. Becker [Tue, 15 Dec 2020 10:28:01 +0000 (11:28 +0100)]
7.3.27 is next

4 years agoJIT: Update invalid opcache.jit INI value message to include "tracing" and "function...
Ayesh Karunaratne [Wed, 2 Dec 2020 21:07:47 +0000 (04:07 +0700)]
JIT: Update invalid opcache.jit INI value message to include "tracing" and "function" values

`opcache.jit` accepts `tracing` and `function` as aliases, but they were not mentioned in the start-up INI warning message.
This updates the error message to include all possible values.

Closes GH-6490.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Tue, 15 Dec 2020 09:15:47 +0000 (10:15 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  IBM i PASE doesn't support ITIMER_PROF

4 years agoIBM i PASE doesn't support ITIMER_PROF
Calvin Buckley [Thu, 10 Dec 2020 18:25:32 +0000 (14:25 -0400)]
IBM i PASE doesn't support ITIMER_PROF

Like Cygwin, this platform needs to use a real-time timer.

This was based on a patch by @kadler, but it didn't handle unsetting
the timer, so the timeout would continue to be active, triggering
`hard_timeout` unexpectedly. The patch is fixed to handle unsetting.

Closes GH-6503.

4 years agoJIT disabled build fix.
David Carlier [Mon, 14 Dec 2020 18:42:52 +0000 (18:42 +0000)]
JIT disabled build fix.

Closes GH-6514.

4 years agoAdd Windows support for OCI 19
Christoph M. Becker [Mon, 14 Dec 2020 21:42:54 +0000 (22:42 +0100)]
Add Windows support for OCI 19

As requested by Christopher Jones.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Mon, 14 Dec 2020 17:27:53 +0000 (18:27 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Drop pdo_mysql_prepare_load_data.phpt

4 years agoDrop pdo_mysql_prepare_load_data.phpt
Christoph M. Becker [Fri, 11 Dec 2020 18:20:16 +0000 (19:20 +0100)]
Drop pdo_mysql_prepare_load_data.phpt

Like the test title and some comments in this test describe, this test
was supposed to have `::prepare()` failing because `LOAD DATA INFILE`
would not be supported as prepared statement, and then the test checks
whether follow-up queries would succeed.  However, `LOAD DATA INFILE`
is supported for prepared statements at least on Windows with mysqlnd,
so the test does no longer test what it is supposed to do.  Therefore,
we drop it.

Closes GH-6509.

4 years agoRemove unused flag
Dmitry Stogov [Mon, 14 Dec 2020 12:29:21 +0000 (15:29 +0300)]
Remove unused flag

4 years agoFixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1))
Dmitry Stogov [Mon, 14 Dec 2020 12:28:03 +0000 (15:28 +0300)]
Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1))

4 years agoFixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1))
Dmitry Stogov [Mon, 14 Dec 2020 12:26:11 +0000 (15:26 +0300)]
Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1))

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Jakub Zelenka [Sun, 13 Dec 2020 18:42:11 +0000 (18:42 +0000)]
Merge branch 'PHP-7.4' into PHP-8.0

4 years agoFix bug #69625: FPM returns 200 status on request without SCRIPT_FILENAME
Jakub Zelenka [Sat, 28 Nov 2020 21:27:53 +0000 (21:27 +0000)]
Fix bug #69625: FPM returns 200 status on request without SCRIPT_FILENAME

4 years agoRemove bug41347.phpt as the error cases are already tested
ekinhbayar [Fri, 11 Dec 2020 10:07:07 +0000 (13:07 +0300)]
Remove bug41347.phpt as the error cases are already tested

Closes GH-6506.

4 years agoFixed bug #79132
Nikita Popov [Fri, 11 Dec 2020 15:35:03 +0000 (16:35 +0100)]
Fixed bug #79132

Following cmb's suggestion and replacing the counter with a check
against the bound_params HT, which ensures that both cannot go
out of sync.

4 years agoPDO MySQL: Fix nextRowset() on libmysqlclient with native PS
Nikita Popov [Fri, 11 Dec 2020 13:47:38 +0000 (14:47 +0100)]
PDO MySQL: Fix nextRowset() on libmysqlclient with native PS

The logic after next_result should match the one after execute.
This was the case for mysqlnd but not libmysqlclient, which used
the non-PS logic.

4 years agoPDO MySQL: Don't skip two LOCAL_INFILE tests with libmysqlclient
Nikita Popov [Fri, 11 Dec 2020 13:19:57 +0000 (14:19 +0100)]
PDO MySQL: Don't skip two LOCAL_INFILE tests with libmysqlclient

4 years agoPDO MySQL: Unskip bug_41125.phpt
Nikita Popov [Fri, 11 Dec 2020 12:03:22 +0000 (13:03 +0100)]
PDO MySQL: Unskip bug_41125.phpt

This test was always skipped (leftover debug statement?)

Contrary to the comments in the test and the test expectation,
this actually works fine.

4 years agoFixed bug #67004
Nikita Popov [Fri, 11 Dec 2020 11:43:19 +0000 (12:43 +0100)]
Fixed bug #67004

Repeated execute() with native PS failed to release the previous
result set on libmysqlclient.

Move freeing the result set into a common location.

4 years agoPDO MySQL: Use stmt_next_result with libmysqlclient as well
Nikita Popov [Fri, 11 Dec 2020 11:13:52 +0000 (12:13 +0100)]
PDO MySQL: Use stmt_next_result with libmysqlclient as well

libmysqlclient added this function in version 5.5, which happens
to be the minimum we support. If we have a prepared statement,
we should use it on both mysqlnd and libmysqlclient, even if the
handling afterwards is different.

This fixes error handling with native prepared statements.

4 years agoPDO MySQL: Fix libmysql option test
Nikita Popov [Fri, 11 Dec 2020 11:04:44 +0000 (12:04 +0100)]
PDO MySQL: Fix libmysql option test

The fact that getAttribute() fails for various libmysqlclient-only
options is a known issue, and the test was taking that into account.
However, the change of the default error mode broke the handling.
We need to handle the exceptions now.

4 years agoFixed bug #62889
Nikita Popov [Fri, 11 Dec 2020 10:20:33 +0000 (11:20 +0100)]
Fixed bug #62889

Our minimum libmysqlclient version requirement is high enough
that we don't need to check for MYSQL_OPT_LOCAL_INFILE support.

However, the mysql_get_option() function seems to only be available
since 5.7 (though it's really hard to find any definitie information
on when MySQL introduced certain functions or changes...) so we
need to store the value of the flag locally to make it available
through getAttribute().

4 years agoPDO MySQL: Fix leak with libmysqlclient and multiple rowsets
Nikita Popov [Fri, 11 Dec 2020 09:47:16 +0000 (10:47 +0100)]
PDO MySQL: Fix leak with libmysqlclient and multiple rowsets

stmt->column_count gets reset before the next_rowset handler is
invoked, so we need to fetch the value from the result set instead.

Arguably PDO should be separating the destruction of the previous
result set and the switch to the next result set more cleanly...

4 years agoFix test cases for MariaDB
Dharman [Thu, 10 Dec 2020 23:50:02 +0000 (23:50 +0000)]
Fix test cases for MariaDB

And remove unnecessary try-catch.

Closes GH-6505.

4 years agoFixed bug #72368
Nikita Popov [Thu, 10 Dec 2020 15:52:17 +0000 (16:52 +0100)]
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.

4 years agoAllow drivers to omit error code
Nikita Popov [Thu, 10 Dec 2020 15:03:22 +0000 (16:03 +0100)]
Allow drivers to omit error code

And thus generate error messages that match what PDO emulation
would generate.

This fixes the error message regression from the previous commit.

4 years agoFixed bug #79131
Nikita Popov [Thu, 10 Dec 2020 14:51:17 +0000 (15:51 +0100)]
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.

4 years agoEliminate some repeatable IS_REFERENCE checks
Dmitry Stogov [Thu, 10 Dec 2020 11:45:54 +0000 (14:45 +0300)]
Eliminate some repeatable IS_REFERENCE checks

4 years agoFixed bug #79872 by improving error message
Nikita Popov [Thu, 10 Dec 2020 10:46:29 +0000 (11:46 +0100)]
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().

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Thu, 10 Dec 2020 10:24:08 +0000 (11:24 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #76815

4 years agoFixed bug #76815
Nikita Popov [Thu, 10 Dec 2020 10:21:06 +0000 (11:21 +0100)]
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.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Thu, 10 Dec 2020 09:31:23 +0000 (10:31 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #71145

4 years agoFixed bug #71145
Nikita Popov [Thu, 10 Dec 2020 09:28:10 +0000 (10:28 +0100)]
Fixed bug #71145

Consume any additional result sets when running INIT_COMMAND.

4 years agoEXTERN_C wrapping for GC buffer APIs
twosee [Thu, 10 Dec 2020 06:40:41 +0000 (14:40 +0800)]
EXTERN_C wrapping for GC buffer APIs

Closes GH-6502.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Thu, 10 Dec 2020 09:05:38 +0000 (10:05 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Backport fix for bug #70066

4 years agoBackport fix for bug #70066
Nikita Popov [Wed, 9 Dec 2020 16:24:30 +0000 (17:24 +0100)]
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 106e7e4bca7c0fd975eb219b18e3c34957ba8657.

4 years agoPerform early guard type check for result of FETCH_CONSTANT
Dmitry Stogov [Wed, 9 Dec 2020 19:24:03 +0000 (22:24 +0300)]
Perform early guard type check for result of FETCH_CONSTANT

4 years agoFixed bug #70066
Nikita Popov [Wed, 9 Dec 2020 16:24:30 +0000 (17:24 +0100)]
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.

4 years agoFixed bug #66878
Nikita Popov [Wed, 9 Dec 2020 15:30:01 +0000 (16:30 +0100)]
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.

4 years agoRemove unnecessary more_results() checks
Nikita Popov [Wed, 9 Dec 2020 15:02:49 +0000 (16:02 +0100)]
Remove unnecessary more_results() checks

Just calling next_result() is sufficient.

4 years agoAdd ifdef for mysqlnd only function
Nikita Popov [Wed, 9 Dec 2020 15:03:52 +0000 (16:03 +0100)]
Add ifdef for mysqlnd only function

4 years agoPDO MySQL: Extract common code for handling PS results
Nikita Popov [Wed, 9 Dec 2020 14:28:16 +0000 (15:28 +0100)]
PDO MySQL: Extract common code for handling PS results

4 years agoPDO MySQL: Use set_row_count() helper
Nikita Popov [Wed, 9 Dec 2020 14:20:47 +0000 (15:20 +0100)]
PDO MySQL: Use set_row_count() helper

4 years agoFixed IS_32BIT/IS_SIGNED_32BIT mess
Dmitry Stogov [Wed, 9 Dec 2020 14:16:54 +0000 (17:16 +0300)]
Fixed IS_32BIT/IS_SIGNED_32BIT mess

4 years agoPDO MySQL: Make sure nextRowset() works with partially consumed result
Nikita Popov [Wed, 9 Dec 2020 13:46:49 +0000 (14:46 +0100)]
PDO MySQL: Make sure nextRowset() works with partially consumed result

This was already working in all cases apart from native prepared
statements with unbuffered queries. In that case invoking
stmt_free_result() addresses the issue.

4 years agoPDO MySQL: Handle error during closeCursor()
Nikita Popov [Wed, 9 Dec 2020 13:04:30 +0000 (14:04 +0100)]
PDO MySQL: Handle error during closeCursor()

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Wed, 9 Dec 2020 11:47:23 +0000 (12:47 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #78154

4 years agoFixed bug #78154
Nikita Popov [Wed, 9 Dec 2020 11:46:47 +0000 (12:46 +0100)]
Fixed bug #78154

Handle errors during next_result in exec.

4 years agoFix stmt_free_result implementation and usage
Nikita Popov [Wed, 9 Dec 2020 10:13:48 +0000 (11:13 +0100)]
Fix stmt_free_result implementation and usage

Two bugs both affecting the bug_pecl_7976.phpt test ("works with
mysqlnd" haha):

 * We should not change the connection state in stmt_free_result.
   This makes mysql_stmt_free_result usable under mysqlnd and
   not just libmysqlclient.
 * If we call mysql_stmt_free_result, we still need to consume
   any outstanding result sets.

4 years agoMake XFAILED test less broken
Nikita Popov [Wed, 9 Dec 2020 09:42:44 +0000 (10:42 +0100)]
Make XFAILED test less broken

At least allow it to print some output rather than throw right
away...

4 years agoHandle changing column count in mysqlnd result binding
Nikita Popov [Tue, 8 Dec 2020 15:58:30 +0000 (16:58 +0100)]
Handle changing column count in mysqlnd result binding

If the count changes from prepare to execute and result_bind is
alreadly allocated, reallocate it there.

This is something of a hack. It would be cleaner to require that
result bindings are registered only after execute, when the final
result set fields are known. But mysqli at least directly exposes
this to the user, so we have no guarantee.

4 years agoPDO MySQL: Normalize handling of empty stored procedure result set
Nikita Popov [Tue, 8 Dec 2020 13:28:18 +0000 (14:28 +0100)]
PDO MySQL: Normalize handling of empty stored procedure result set

MySQL always returns a trailing empty result set for stored
procedure calls, which is used to convey status information.
The PDO MySQL implementation is presently confused about what to
do with it: If mysqlnd is used and native prepared statements are
used, this result set is skipped. In all other cases it is not
skipped. We also have quite a few XFAILed tests relating to this.

This patch normalizes (for PHP-8.0 only) the behavior towards
always retaining the empty result set. This is simply how MySQL
stored procedures work (some expletives omitted here) and we can't
distinguish this "useless" result set from an empty result of a
multi query. Multi queries are not a concern for native prepared
statements, as PDO does not allow them in that case, but they are
a concern for emulated prepared statements.

Closes GH-6497.

4 years agoHandle column count change in PDO MySQL
Nikita Popov [Tue, 8 Dec 2020 15:37:00 +0000 (16:37 +0100)]
Handle column count change in PDO MySQL

This has been fixed for PDO SQlite by GH-4313, however the same
issue also applied to PDO MySQL.

Move the column count setting function into the main PDO layer
(and export it) and then use it in both PDO SQLite and PDO MySQL.

4 years agoEnable XFAILed test
Nikita Popov [Tue, 8 Dec 2020 15:03:18 +0000 (16:03 +0100)]
Enable XFAILed test

This one had a rather scary XFAIL message, but seems to work just
fine...

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 8 Dec 2020 11:24:09 +0000 (12:24 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #48725: Support for flushing in zlib stream

4 years agoFix #48725: Support for flushing in zlib stream
Christoph M. Becker [Wed, 19 Aug 2020 16:19:08 +0000 (18:19 +0200)]
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.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Tue, 8 Dec 2020 10:49:14 +0000 (11:49 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #77069: stream filter loses final block of data

4 years agoFix #77069: stream filter loses final block of data
Christoph M. Becker [Tue, 22 Sep 2020 14:02:01 +0000 (16:02 +0200)]
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.

4 years agoldap_exop_whoami() does not return TRUE
Christoph M. Becker [Tue, 8 Dec 2020 10:14:27 +0000 (11:14 +0100)]
ldap_exop_whoami() does not return TRUE

Closes GH-6496.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Tue, 8 Dec 2020 10:35:27 +0000 (11:35 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #63185

4 years agoFixed bug #63185
Nikita Popov [Tue, 8 Dec 2020 10:30:54 +0000 (11:30 +0100)]
Fixed bug #63185

4 years agoAvoid unnecessary checks
Dmitry Stogov [Tue, 8 Dec 2020 10:10:35 +0000 (13:10 +0300)]
Avoid unnecessary checks

4 years agoFix another typed resource issue in unserialization
Nikita Popov [Mon, 7 Dec 2020 11:33:23 +0000 (12:33 +0100)]
Fix another typed resource issue in unserialization

We also need to discard old entries in the ref_props HT when values
are overwritten.

We should really forbid these kinds of overwrites. I believe they
can only occur in manually crafted serialization strings, and
cause so many problems...

Fixes oss-fuzz #28257.

4 years agoFixed bug #80480 (Segmentation fault with JIT enabled)
Dmitry Stogov [Mon, 7 Dec 2020 10:28:37 +0000 (13:28 +0300)]
Fixed bug #80480 (Segmentation fault with JIT enabled)

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Nikita Popov [Fri, 4 Dec 2020 16:00:20 +0000 (17:00 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #80458

4 years agoFixed bug #80458
Dharman [Wed, 2 Dec 2020 21:24:20 +0000 (21:24 +0000)]
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.

4 years agoMerge branch 'PHP-7.4' into PHP-8.0
Christoph M. Becker [Fri, 4 Dec 2020 12:04:16 +0000 (13:04 +0100)]
Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix #75102: `PharData` says invalid checksum for valid tar