Commit graph

1988 commits

Author SHA1 Message Date
Kamil Tekiela
5b60370906
mysqli_query throws warning despite using silenced error mode (#9842) 2022-10-27 18:24:28 +01:00
Arnaud Le Blanc
80232de0e4
Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Christoph M. Becker
a7a590211e
Fix mysqli tests wrt. MySQL 8.0.28
As of MySQL 8.0.28, `utf8mb3` charset is reported by the server, but
mysqlnd doesn't support it yet.  As a stop-gap measure, we ignore that
charset for now.

Closes GH-8480.
2022-05-09 10:55:32 +02:00
Michael Voříšek
36de002cc6
Verify generated files are up to date in CI
Closes GH-8295
2022-04-21 23:25:47 +02:00
Christoph M. Becker
7c702b72f2
Fix GH-8267: MySQLi uses unsupported format specifier on Windows
Instead of using the unsupported `%I64u` and `%I64d` format specifiers
on Windows, we use the portable `PRIu64` and `PRId64` specifiers.

The `L64()` macro and the `my_longlong` typedef should be adapted as
well, as the `i64` literal suffix is still supported by MSVC, but using
`LL` or `ll` is recommended[1], and the standard `int64_t` is available
there anyway.  This is not urgent, though.

[1] <https://docs.microsoft.com/en-us/cpp/cpp/numeric-boolean-and-pointer-literals-cpp?view=msvc-170#integer-literals>

Closes GH-8268.
2022-04-07 17:03:15 +02:00
Christoph M. Becker
ef29ddcc27
Fix GH-8068: mysqli_fetch_object creates inaccessible properties
When fetching into objects, we need to create object style hash tables,
i.e. where numeric column names are stored as string keys instead of
integer keys.  Instead of the slightly more efficient alternative to
create the desired hash table in the first place, we go for the more
readable implementation and convert the array style hash table using
`zend_symtable_to_proptable()`.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>

Closes GH-8189.
2022-03-14 14:27:04 +01:00
Kamil Tekiela
93a8d5cd17
Fix bug GH-8058 - mysqlnd segfault when prepare fails
Closes GH-8061
2022-02-14 11:45:17 +00:00
Kamil Tekiela
5fc0db989e
Strip MariaDB 10 prefix
Closes GH-7972
2022-01-19 21:39:42 +00:00
Christoph M. Becker
d963b3f015
mysqli_next_result_no_repeat_error.phpt must not use --EXTENSIONS--
This is only properly supported as of PHP 8.1.0[1], and may cause
spurious test failures for older versions[2].

[1] <https://github.com/php/php-src/pull/6787>
[2] <42044075/job/tk4138s43p1953hx>
2021-12-31 00:24:56 +01:00
Kamil Tekiela
49512b6b36
Fix formatting in the new mysqli test 2021-12-30 19:25:32 +00:00
NathanFreeman
b3903515bf
Fix bug where large bigints may be truncated
Unless stringified results are requested, we need to parse large
bigints as unsigned, to avoid wrap-around behavior.

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

Closes GH-7837.
2021-12-30 19:07:36 +01:00
Kamil Tekiela
c9d509b668
Revert "Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible)"
This reverts commit 64fca5c5f0.
2021-10-21 19:01:01 +01:00
Kamil Tekiela
64fca5c5f0
Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible) 2021-10-21 18:51:16 +01:00
Nikita Popov
df940a6dc3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81494
2021-10-08 15:00:51 +02:00
Nikita Popov
fcabe693ba Fixed bug #81494
Use the proper error reporting mechanism rather than throwing a
warning. This requires something of a hack because we don't have
direct access to the connection object at this point.
2021-10-08 15:00:10 +02:00
Christoph M. Becker
606829f31f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74544: Integer overflow in mysqli_real_escape_string()
2021-08-10 00:06:58 +02:00
Christoph M. Becker
5977610de1
Fix #74544: Integer overflow in mysqli_real_escape_string()
The patch has been provided by @johannes.

Closes GH-7353.
2021-08-10 00:05:39 +02:00
Kamil Tekiela
65e2dbd0de
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Prevent mysqli::next_result from reporting errors from previous calls (#7304)
2021-07-27 11:56:14 +01:00
Kamil Tekiela
d26069a2f1
Prevent mysqli::next_result from reporting errors from previous calls (#7304) 2021-07-27 11:50:28 +01:00
Máté Kocsis
ceb0951fa5
mysqli_get_client_info() cannot return null
This method is already deprecated
2021-05-26 17:48:35 +02:00
Máté Kocsis
97f7279353
Fix the return type of mysqli_connect() 2021-05-26 12:07:02 +02:00
Máté Kocsis
86ef34fc61
Fix the return type of mysqli::connect() 2021-05-26 11:55:03 +02:00
Máté Kocsis
e8361eb0e3
Fix return type of mysqli::init() 2021-05-07 15:21:41 +02:00
Nikita Popov
6493b516f9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80837
2021-03-15 14:38:49 +01:00
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
Nikita Popov
f06efce387 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  mysqlnd pam fix test error message
2021-02-25 09:52:07 +01:00
Daniel Black
8309c04464 mysqlnd pam fix test error message
Closes GH-6727.
2021-02-25 09:51:51 +01:00
Nikita Popov
8b9dd0a301 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78680: mysqlnd pam plugin missing terminating null
2021-02-15 11:32:54 +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
39c6aaa9cc Make mysqli_ssl_set() arguments nullable
This function internally converts zero length arguments to NULL
argument -- but we should also accept them in the first place.

Null arguments being accepted was actually documented, before
bug #78399 adjusted the docs to match current behavior.
2021-02-10 15:31:27 +01:00
Christoph M. Becker
f23bfc4b43 Fix test expectation for PHP 8.0
Since float to string conversion is no longer locale dependent, we have
to expect a dot as decimal separator.
2021-02-05 14:55:26 +01:00
Christoph M. Becker
95e405023e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Use ST_Y() instead of the deprecated/removed Y() in test
2021-02-05 14:54:25 +01:00
Christoph M. Becker
4ff2665509 Use ST_Y() instead of the deprecated/removed Y() in test 2021-02-05 14:53:19 +01:00
Christoph M. Becker
4be5b4aa25 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74779: x() and y() truncating floats to integers
2021-02-05 13:12:03 +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
Dharman
34ef804b04 Make fetch_* OO same as func
Clsoses GH-6580.
2021-01-06 15:02:52 +01:00
Dharman
44a311dbbe Fix/improve mysqli stubs
* mysqli_commit $flags default value is 0, not -1.
* A number of functions cannot actually return null.
* mysqli_poll parameter names were incorrect, as this function
  has a different signature from select.
* fetch functions apart from fetch_all can return false on failure.
2021-01-06 11:28:45 +01:00
Nikita Popov
ab84623108 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  MySQLnd: Support cursors in store/get result
2020-12-18 10:20:13 +01: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
1a66d64717 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #67983
2020-12-16 10:53:48 +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
1a1eeee716 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix mysqli_expire_password test for mariadb
2020-12-03 11:02:11 +01:00
Nikita Popov
0f6c41c6f8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix mysqli_expire_password test for mariadb
2020-12-03 11:01:57 +01:00
Daniel Black
0697a64f7e Fix mysqli_expire_password test for mariadb
In MariaDB-10.4.3 EXPIRE passwords where supported for
MariaDB. This only behaves like MySQL when the system
variable disconnect_on_expired_passwords=1.

MariaDB if there was no password it could not be considered
expired. So the test is adjusted to use actual passwords.
(MariaDB commit a94b20a8e0d9e64eeaabdaaa7a3e03fcdb8a686e)

The error codes produced my MariaDB are different
however still conforming to the SQL specification.

Closes GH-6480.
2020-12-03 10:56:00 +01:00
Nikita Popov
98cccd304a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fix mysqli_stmt_get_result_metadata_fetch_field test for mariadb
2020-12-03 10:45:27 +01:00
Daniel Black
5d5c1cea5f fix mysqli_stmt_get_result_metadata_fetch_field test for mariadb
MariaDB extended the default decimal field to 39 characters
instead of MySQL's 31 characters.

This small change allows the test to pass on MySQL and MariaDB.

Closes GH-6484.
2020-12-03 10:45:11 +01:00
Dharman
261faa62da Remove PHP 5 mysqli tests
These tests all require functions that no longer exist.
2020-12-03 10:42:46 +01:00
Dharman
53f7bddbeb Fix typos in mysql tests
%d because of line endings on Windows
2020-12-03 10:42:39 +01:00
Daniel Black
4a10037cb4 Fix mysqli_get_client_stats test
MySQL removed RENAME DATABASE in 18300001c1dbbfddf9a0adcbaeea68956102bdd0
(Sept 2007, 5.1.23). As this briefest existance is very insignificant lets remove it.

It also breaks when testing against MariaDB.

As the alternate path in this test covers all supported MySQL and MariaDB
versions and a signifant portion of unsupported versions lets keep it simple.

Closes GH-6459.
2020-11-27 11:43:34 +01:00
Nikita Popov
518eb0ca2b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed error reporting in mysqli_stmt::__construct
2020-11-25 16:29:00 +01:00