Commit Graph

121755 Commits

Author SHA1 Message Date
Christoph M. Becker
15d9c42070 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Drop pdo_mysql_prepare_load_data.phpt
2020-12-14 18:27:53 +01:00
Christoph M. Becker
10c9d615de 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.
2020-12-14 18:26:12 +01:00
Dmitry Stogov
b3377028dc Remove unused flag 2020-12-14 15:29:21 +03:00
Dmitry Stogov
66e390707c Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1)) 2020-12-14 15:28:03 +03:00
Dmitry Stogov
a12e7affd7 Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1)) 2020-12-14 15:26:11 +03:00
Jakub Zelenka
d254078020 Merge branch 'PHP-7.4' into PHP-8.0 2020-12-13 18:42:11 +00:00
Jakub Zelenka
a221e17b41 Fix bug #69625: FPM returns 200 status on request without SCRIPT_FILENAME 2020-12-13 18:39:48 +00:00
ekinhbayar
b0e858da8b Remove bug41347.phpt as the error cases are already tested
Closes GH-6506.
2020-12-11 16:47:40 +01:00
Nikita Popov
ccb7f1c7d8 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.
2020-12-11 16:35:03 +01:00
Nikita Popov
7a89157f8c 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.
2020-12-11 14:48:44 +01:00
Nikita Popov
81f012a164 PDO MySQL: Don't skip two LOCAL_INFILE tests with libmysqlclient 2020-12-11 14:48:43 +01:00
Nikita Popov
e4e88bd7e3 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.
2020-12-11 13:04:20 +01:00
Nikita Popov
ad8eb116d8 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.
2020-12-11 12:52:59 +01:00
Nikita Popov
d6b4b82a38 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.
2020-12-11 12:20:04 +01:00
Nikita Popov
4e51059d52 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.
2020-12-11 12:20:02 +01:00
Nikita Popov
43741a3f26 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().
2020-12-11 11:25:36 +01:00
Nikita Popov
c927c831e6 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...
2020-12-11 10:51:14 +01:00
Dharman
54a63d91b8 Fix test cases for MariaDB
And remove unnecessary try-catch.

Closes GH-6505.
2020-12-11 09:53:20 +01:00
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
a5527577e7 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.
2020-12-10 16:04:33 +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
Dmitry Stogov
dde5572937 Eliminate some repeatable IS_REFERENCE checks 2020-12-10 14:45:54 +03: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
twosee
26c7b9402d EXTERN_C wrapping for GC buffer APIs
Closes GH-6502.
2020-12-10 17:15:19 +08:00
Nikita Popov
c95680d4b7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Backport fix for bug #70066
2020-12-10 10:05:38 +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
Dmitry Stogov
e9f9e9f863 Perform early guard type check for result of FETCH_CONSTANT 2020-12-09 22:24:03 +03: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
ef342b0730 Remove unnecessary more_results() checks
Just calling next_result() is sufficient.
2020-12-09 16:16:17 +01:00
Nikita Popov
a073b0218c Add ifdef for mysqlnd only function 2020-12-09 16:16:17 +01:00
Nikita Popov
b9ea8d6b96 PDO MySQL: Extract common code for handling PS results 2020-12-09 15:28:16 +01:00
Nikita Popov
fb69c7752d PDO MySQL: Use set_row_count() helper 2020-12-09 15:21:12 +01:00
Dmitry Stogov
8d268e8443 Fixed IS_32BIT/IS_SIGNED_32BIT mess 2020-12-09 17:16:54 +03:00
Nikita Popov
186b766368 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.
2020-12-09 14:46:49 +01:00
Nikita Popov
23193e89e4 PDO MySQL: Handle error during closeCursor() 2020-12-09 14:04:30 +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
Nikita Popov
18517e7a63 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.
2020-12-09 11:13:48 +01:00
Nikita Popov
9c0712d2cd Make XFAILED test less broken
At least allow it to print some output rather than throw right
away...
2020-12-09 10:42:44 +01:00
Nikita Popov
311a77d08e 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.
2020-12-09 10:30:23 +01:00
Nikita Popov
2df09b9b64 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.
2020-12-08 17:01:56 +01:00
Nikita Popov
bfa69d27bc 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.
2020-12-08 16:41:35 +01:00
Nikita Popov
713ef8511b Enable XFAILed test
This one had a rather scary XFAIL message, but seems to work just
fine...
2020-12-08 16:03:50 +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