Commit graph

1236 commits

Author SHA1 Message Date
Dharman
3dfd3558ca Deprecate mysqli driver_version property
The driver version hasn't been updated in 13 years, so this number
is essentially meaningless. Check PHP_VERSION_ID instead.
2021-03-15 10:48:36 +01:00
Dharman
4bd3cb6626 Clean up mysqli_driver test cases
And remove an unnecessary test case that is already covered by the
other two.
2021-03-15 10:34:55 +01:00
Dharman
321e0d451d client_info is a constant and doesn't need a connection
Closes GH-6767.
2021-03-15 10:24:42 +01:00
Max Semenik
c639d34a6e Update mysqli tests to work with newer MySQL server
* @@session.old_passwords is present only in 5.6 and 5.7. Newer versions
  already behave as if they have old_passwords=2.
* SET PASSWORD FOR ... = PASSWORD(...) syntax was removed in 8.0.

For all affected tests, versions that don't support newer SQL are
already explicitly excluded with version checks.

Closes GH-6729.
2021-03-04 16:34:11 +01:00
Nikita Popov
4d43cbe333 Add mechanism to skip the skipif cache
If the SKIPIF section return nocache, don't cache the result. This
is used by tests that perform complex test set in conjunction with
skip checks, and need to be evaluated every time.
2021-03-04 16:28:11 +01:00
Nikita Popov
500b4b4945 Explicitly print reference wrappers in debug_zval_dump()
Closes GH-6750.
2021-03-04 10:11:37 +01:00
Nikita Popov
3a867b9827 Fixed bug #80808
If the ZEROFILL flag is set for a field, do not convert it into
an integer (text protocol) or convert it explicitly into a padded
string (binary protocol).
2021-03-02 10:59:34 +01:00
Dmitry Stogov
72c3ededed Change the order of properties used for var_dump(), serialize(), comparison, etc.
Now properties are ordered according to their layout in zend_object structure.
2021-03-01 13:29:49 +03:00
Nikita Popov
7920c9dd44 Merge branch 'PHP-8.0'
* PHP-8.0:
  mysqlnd pam fix test error message
2021-02-25 09:52:18 +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
Darek Slusarczyk
da011a312a Fix #80329: Add option to specify LOAD DATA LOCAL white list folder
* allow the user to specify a folder where files that can be sent
   via LOAD DATA LOCAL can exist
 * add mysqli.local_infile_directory for mysqli
   (ignored if mysqli.allow_local_infile is enabled)
 * add PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY for pdo_mysql
   (ignored if PDO::MYSQL_ATTR_LOCAL_INFILE is enabled)
 * add related tests
 * fixes for building with libmysql 8.x
 * small improvement in existing tests
 * update php.ini-[development|production] files

Closes GH-6448.

Co-authored-by: Nikita Popov <nikic@php.net>
2021-02-23 09:30:46 +01:00
Nikita Popov
f01ad22bab Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #78680: mysqlnd pam plugin missing terminating null
2021-02-15 11:33:01 +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
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Christoph M. Becker
320843fe7b Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix test expectation for PHP 8.0
  Use ST_Y() instead of the deprecated/removed Y() in test
2021-02-05 14:55:45 +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
3b08b422a7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #74779: x() and y() truncating floats to integers
2021-02-05 13:12:30 +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
Darek Slusarczyk
ed24f0f201 Fix #80330: Replace language in APIs and source code/docs
Rename MYSQLI_REFRESH_SLAVE to MYSQLI_REFRESH_REPLICA in line with
upstream change in MySQL. The old name is retained for
backwards-compatibility reasons, and may be deprecated/removed in
the future.

Closes GH-6632.
2021-01-25 10:10:47 +01:00
Nikita Popov
e2c8ab7c33 Print "interned" instead of fake refcount in debug_zval_dump()
debug_zval_dump() currently prints refcount 1 for interned strings
and arrays, which does not really reflect the truth. These values
are not refcounted, so the refcount is misleading. Instead print
an "interned" tag.

Closes GH-6598.
2021-01-15 12:21:24 +01:00
Nikita Popov
037512cfce Move fetch_all implementation out of mysqlnd
There doesn't seem to be any compelling reason to implement this
in mysqlnd rather than mysqli. It's just a loop over fetch_into.

This makes the function available under libmysqlclient as well,
and thus fixes bug #79372.
2020-12-18 12:27:30 +01:00
Nikita Popov
4ceea869ee Merge branch 'PHP-8.0'
* PHP-8.0:
  MySQLnd: Support cursors in store/get result
2020-12-18 10:20:55 +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
890e4caf0b Drop support for max_length in mysqli_fetch_fields()
Retain the field, but always populate it with zero. This was
already the case for PS without length updating.

max_length has nothing lost in the field metadata -- it is a
property of the specific result set, and requires scanning the
whole result set to compute. PHP itself never uses max_length
with mysqlnd, it is only exposed in the raw mysqli API.

Keeping it for just that purpose is not worthwhile given the costs
involved. People who actually need this for some reason can easily
calculate it themselves, while making it obvious that the
calculation requires a full result set scan.
2020-12-17 10:01:02 +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
Dharman
233f507fe6 Fixed error reporting in mysqli_stmt::__construct
For the sake of simplicity, I've synchronized the implementation
with PHP 8, which means null values are also accepted.

Closes GH-6454.
2020-11-25 16:27:41 +01:00
Nikita Popov
e3e67b721f Reindent more mysqli tests
Due to a bug in the tidy script, most tests did not actually get
reindented...
2020-11-25 16:07:16 +01:00
Nikita Popov
97d192b444 Reindent ext/mysqli tests
Reindent ext/mysqli tests on PHP-7.4, so they match with the
indentation on PHP-8.0. Otherwise merging test changes across
branches is very unpleasant.
2020-11-25 15:57:11 +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
d776c31a34 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle errors during next_result()
2020-11-11 16:03:10 +01:00
Nikita Popov
eda7492604 Handle errors during next_result() 2020-11-11 16:02:52 +01:00
Dharman
114613dc5f Remove embedded property from mysqli_driver
All other leftovers of this feature have been dropped in PHP 8,
so we should remove the property as well.

Closes GH-6407.
2020-11-09 11:00:16 +01:00
Dharman
cf38a6f51f Fix tests for MariaDB
Closes GH-6390.
2020-11-02 09:58:46 +01:00