Commit Graph

872 Commits

Author SHA1 Message Date
Nikita Popov
39d20b474d Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Handle error during closeCursor()
2020-12-09 14:05:54 +01:00
Nikita Popov
23193e89e4 PDO MySQL: Handle error during closeCursor() 2020-12-09 14:04:30 +01:00
Nikita Popov
7eae14690f Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #78154
2020-12-09 12:47:48 +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
de22980ac8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix stmt_free_result implementation and usage
  Make XFAILED test less broken
2020-12-09 11:24:48 +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
c77bf40ad9 Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle changing column count in mysqlnd result binding
2020-12-09 10:30:36 +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
dc58a1e6d7 Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Normalize handling of empty stored procedure result set
2020-12-08 17:02:13 +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
0ac8518d76 Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle column count change in PDO MySQL
2020-12-08 16:42:54 +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
f531b84b13 Merge branch 'PHP-8.0'
* PHP-8.0:
  Enable XFAILed test
2020-12-08 16:04:08 +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
Nikita Popov
c22f1d4551 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #63185
2020-12-08 11:36:03 +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
Nikita Popov
89bbaf505a Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80458
2020-12-04 17:01:19 +01: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
Nikita Popov
14458ec7e9 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80312: change default engine from MyISAM to InnoDB in tests
2020-11-17 13:16:32 +01:00
Nikita Popov
f4a600be04 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80312: change default engine from MyISAM to InnoDB in tests
2020-11-17 13:16:17 +01:00
Darek Slusarczyk
79a606bd95 Fix #80312: change default engine from MyISAM to InnoDB in tests
Change mysqli and pdo_mysql tests configuration to use by default
InnoDB instead of MyISAM.

Closes GH-6405.
2020-11-17 13:15:15 +01:00
Nikita Popov
be29853353 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't assume libmysqlclient library name
2020-11-12 15:12:57 +01:00
Nikita Popov
34dd032e4e Don't assume libmysqlclient library name
By simply dropping the additional checks, in line with the general
guideline of trusting the output of config scripts (this should
be migrated to pkg-config though).

Also drop the code for manually adding -z if mysql_config does not
-- that's not our problem.
2020-11-12 15:11:56 +01:00
Nikita Popov
bcdb54d476 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix tests for MariaDB
2020-11-02 09:59:45 +01:00
Dharman
cf38a6f51f Fix tests for MariaDB
Closes GH-6390.
2020-11-02 09:58:46 +01:00
Nikita Popov
39532f9c52 Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle errors during PDO row fetch
2020-10-29 14:18:22 +01:00
Nikita Popov
1a7bcd9892 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle errors during PDO row fetch
2020-10-29 14:18:04 +01:00
Nikita Popov
0044a81fbb Handle errors during PDO row fetch
The EOF flag also gets set on error, so we always end up ignoring
errors here.

However, we should only check errors for unbuffered results. For
buffered results, this function is guaranteed not to error, and
querying the errno may return an unrelated error.
2020-10-29 14:17:29 +01:00
Nikita Popov
bd555b6cca Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #66528
2020-10-28 12:18:26 +01:00
Nikita Popov
39be0df2ed Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #66528
2020-10-28 12:18:17 +01:00
Nikita Popov
68dcaa29d8 Fixed bug #66528
Report errors in commit, rollback and autocommit handlers.
2020-10-28 12:18:02 +01:00
Nikita Popov
dc03e621b8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix bug #79375
2020-10-28 11:04:41 +01:00
Nikita Popov
793bf12f8c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #79375
2020-10-28 11:04:32 +01: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
Nikita Popov
18d373e8c3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix inconsistency in PDO transaction state
2020-10-26 17:01:25 +01:00
Nikita Popov
7b9519a792 Fix inconsistency in PDO transaction state
This addresses an issue introduced by #4996 and reported in
https://bugs.php.net/bug.php?id=80260.

Now that PDO::inTransaction() reports the real transaction state
of the connection, there may be a mismatch with PDOs internal
transaction state (in_tcx). This is compounded by the fact that
MySQL performs implicit commits for DDL queries.

This patch fixes the issue by making beginTransaction/commit/rollBack
work on the real transaction state provided by the driver as well
(or falling back to in_tcx if the driver does not support it).

This does mean that writing something like

    $pdo->beginTransaction();
    $pdo->exec('CREATE DATABASE ...');
    $pdo->rollBack(); // <- illegal

will now result in an error, because the CREATE DATABASE already
committed the transaction. I believe this behavior is both correct
and desired -- otherwise, there is no indication that the code did
not behave correctly and the rollBack() was effectively ignored.
However, this is also a BC break.

Closes GH-6355.
2020-10-26 17:01:18 +01:00
Nikita Popov
e735de6eae Add GC support for PDO driver data
Add a get_gc method that can be implemented by drivers, which can
be used to add additional zvals to the GC buffer.

Implement GC support for PDO SQLite callbacks in particular.

Closes GH-6262.
2020-10-12 13:00:41 +02:00
Nikita Popov
0f3698173e Update PDO parameter names
Followup to previous changes:
 * Use camel case, as PDO uses a camel case OO API.
 * Use &$var instead of &$bind_var or &$param.
 * Use $column instead of $index. We have cases (both inside PDO
   and in other DB exts) where columns can also be represented as
   strings, so $column is the safer generic name.

Closes GH-6272.
2020-10-05 15:51:36 +02:00
Larry Garfield
ea03cbebbc Update PDO parameters for named arguments.
Closes GH-6220
2020-09-28 23:02:05 +01:00
George Peter Banyard
7553c696c3 Another pass making some failure states unconditional erros in PDO
Also make internal function return type more accurate to inform usage
2020-09-28 19:35:31 +01:00
George Peter Banyard
a5cf82802d Make various failure conditions in PDO unconditional errors
This includes TypeErrors, ValueErrors, Error for uninitialized objects
and invalid user classes/callable instanciation

Closes GH-6212
2020-09-28 18:51:36 +01:00
George Peter Banyard
9fab1b90ab Drop ZPP check in PDO MySQLi test
This test is marked as XFAIL so it doesn't get looked at.

It checks that the method is called without arguments which is a ZPP concern
2020-09-28 18:51:35 +01:00
twosee
6a4eeb1c47 Improve PDO::inTransaction() support for MySQL
Closes GH-4996.
2020-09-23 11:50:06 +02:00
Nikita Popov
19314ff887 Fix some tests for libmysql 2020-09-18 18:01:04 +02:00
Nikita Popov
9962ad6444 Merge branch 'PHP-7.4'
* PHP-7.4:
  Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
2020-09-18 15:26:04 +02:00
Nikita Popov
e6dc9abdb7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
2020-09-18 15:25:35 +02:00
Nikita Popov
70cba36fc9 Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
Requires the use of mysql_real_escape_string_quote().
2020-09-18 15:24:57 +02:00