summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-8.0'Nikita Popov2021-03-151-1/+1
|\ | | | | | | | | * PHP-8.0: Fix bug #80837
| * Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2021-03-151-1/+1
| |\ | | | | | | | | | | | | * PHP-7.4: Fix bug #80837
| | * Fix bug #80837Dharman2021-03-151-1/+1
| | | | | | | | | | | | The error needs to be reported on the statement, not the connection.
* | | Fixed bug #80808Nikita Popov2021-03-022-1/+7
| | | | | | | | | | | | | | | | | | 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).
* | | Fix Windows buildNikita Popov2021-02-231-1/+1
| | | | | | | | | | | | Don't add to a void pointer.
* | | Remove free_chunk APINikita Popov2021-02-233-54/+2
| | | | | | | | | | | | | | | | | | This API only works in very limited circumstances -- relying on it will invariably lead to leaks. The correct way to "free" something from the pool is to use the checkpoint API.
* | | Remove resize_chunk APINikita Popov2021-02-232-29/+0
| | | | | | | | | | | | | | | The last user has been dropped in the previous commit. This has never worked meaningfully in the first place.
* | | Fixed bug #80761Nikita Popov2021-02-231-35/+27
| | | | | | | | | | | | | | | | | | | | | When row data split across multiple packets, allocate a temporary buffer that can be reallocated, and only copy into the row buffer pool arena once we know the final size. This avoids quadratic memory usage for very large results.
* | | Fix #80329: Add option to specify LOAD DATA LOCAL white list folderDarek Slusarczyk2021-02-234-3/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | | Merge branch 'PHP-8.0'Nikita Popov2021-02-161-2/+3
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Handle incomplete result set metadata more gracefully
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2021-02-161-2/+3
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Handle incomplete result set metadata more gracefully
| | * Handle incomplete result set metadata more gracefullyNikita Popov2021-02-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Rather than segfaulting because sname is missing lateron, report a FAIL here. As this indicates a server bug, the errors is reported as an out of band warning, rather than a client error. This fixes the PHP side of bug #80713.
* | | Merge branch 'PHP-8.0'Nikita Popov2021-02-151-1/+5
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fix #78680: mysqlnd pam plugin missing terminating null
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2021-02-151-1/+5
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fix #78680: mysqlnd pam plugin missing terminating null
| | * Fix #78680: mysqlnd pam plugin missing terminating nullDaniel Black2021-02-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-8.0'Christoph M. Becker2021-02-051-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fix #74779: x() and y() truncating floats to integers
| * | Merge branch 'PHP-7.4' into PHP-8.0Christoph M. Becker2021-02-051-1/+1
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fix #74779: x() and y() truncating floats to integers
| | * Fix #74779: x() and y() truncating floats to integersChristoph M. Becker2021-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix #80330: Replace language in APIs and source code/docsDarek Slusarczyk2021-01-252-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Replace zend_bool uses with boolNikita Popov2021-01-1529-205/+205
| | | | | | | | | | | | | | | | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* | | Make convert_to_*_ex simple aliases of convert_to_*Nikita Popov2021-01-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, the _ex variants separated the zval first, if a conversion was necessary. This distinction no longer makes sense since PHP 7. The only difference that was still left is that _ex checked whether the type is the same first, but the usage of these macros did not actually distinguish on whether such an inlined check is valuable or not in a given context. Also drop the unused convert_to_explicit_type macros.
* | | Avoid throwing warnings in mysqlndDharman2021-01-044-19/+26
| | | | | | | | | | | | | | | | | | Instead report them as proper client errors. Closes GH-6530.
* | | Move fetch_all implementation out of mysqlndNikita Popov2020-12-183-40/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-8.0'Nikita Popov2020-12-181-59/+72
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: MySQLnd: Support cursors in store/get result
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-181-59/+72
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: MySQLnd: Support cursors in store/get result
| | * MySQLnd: Support cursors in store/get resultNikita Popov2020-12-181-59/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | MySQLnd: Remove mnd_malloc/free etc.Nikita Popov2020-12-176-213/+4
| | | | | | | | | | | | | | | | | | There were only two uses of non-zmm allocation functions left, which really did not need to use the system allocator. Remove them, and remove the system allocator based APIs.
* | | MySQLnd: Fix potential leak when reading cursorNikita Popov2020-12-171-6/+9
| | | | | | | | | | | | | | | Perform the same checkpointing twe do in other row reading functions.
* | | MySQLnd: Avoid some reallocations in PS decoderNikita Popov2020-12-171-48/+13
| | |
* | | PDO MySQL: Use native types for resultsNikita Popov2020-12-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, PDO MySQL only fetched data as native int/float if native prepared statements were used. This patch updates PDO to have the same behavior for emulated prepared statements, and thus removes the largest remaining discrepancy between these two modes. Note that PDO already has a ATTR_STRINGIFY_FETCHES option to control whether native types are desired or not. The previous output can be restored by enabling this option. Most of the tests make use of that option, because this allows the tests to work under libmysqlclient as well, which currently always returns string results (independently of whether native or emulated PS are used).
* | | MySQLnd: Clean up and optimize mysqlnd result set handlingNikita Popov2020-12-1713-1059/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a larger overhaul of the mysqlnd result set infrastructure: * Drop support for two different types of buffered results sets ("c" and "zval"). Possibly these made sense at some earlier time, but now (with minor adjustments) one option is strictly worse than the other. Buffered result sets already buffer the full row packets, from which zvals can be decoded. The "zval" style additionally also buffered the decoded zvals. As result sets, even buffered ones, are generally only traversed once, this just ends up wasting memory. Now, a potentially useful variation here would be to buffer the decoded zvals instead of the row packets, but that's not what the code was doing. * To make it really strictly better, pre-allocate the zval row buffer and reuse it for all rows. Previously the "c" style always allocated a new buffer for each row. * The fetch_row API now provides a populated zval[]. The task of populating an array is deferred to fetch_row_into, which also avoids duplicating this code in multiple places. The fetch_row_c API is also implemented on top of fetch_row now, rather than duplicating large parts of the code. * The row fetching code for prepared statements and normal result sets has been mostly merged. These already used the same infrastructure, but prepared statements used separate row fetching functions that were nearly the same as the normal ones. This requires passing the stmt into the result set, rather than just a flag. The only part that remains separate is reading of unbuffered results in the presence of PS cursors.
* | | Drop support for max_length in mysqli_fetch_fields()Nikita Popov2020-12-174-272/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-8.0'Nikita Popov2020-12-161-20/+20
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #67983
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-161-22/+23
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fixed bug #67983
| | * Fixed bug #67983Nikita Popov2020-12-161-22/+23
| | | | | | | | | | | | | | | We need to check the BIT case first, otherwise it will get skipped in INT_AND_FLOAT_NATIVE mode.
* | | MySQLnd: Drop free_result_internalNikita Popov2020-12-153-20/+4
| | | | | | | | | | | | | | | | | | | | | Merge it into free_result. There is a large number of different free_* functions for result sets, let's avoid having one more. Only difference is that it does not increment stats, and that seems like a bug as free_stmt_result is still freeing a result.
* | | MySQLnd: Simplify management of zval row bufferNikita Popov2020-12-154-105/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Something odd was being done here, with the row packet having a flag for whether it should allocate the zval buffer, which would then get moved into the result set. Keep the management of this buffer purely at the result set level. This also allows us to easily reuse the same buffer for all results, rather than allocating a new one for each fetch.
* | | Remove mysqlnd_extension enumNikita Popov2020-12-154-20/+5
| | | | | | | | | | | | | | | ext/mysql is no longer supported, drop handling for it from mysqlnd.
* | | MySQLnd: Remove unused fetch_field_data methodNikita Popov2020-12-153-40/+0
| | | | | | | | | | | | | | | This method is not used, and is implemented in a very dubious way.
* | | Use zmm for row_c dataNikita Popov2020-12-141-2/+2
| | | | | | | | | | | | | | | This API already doesn't match libmysqlclient, so we may as well use the zmm.
* | | mysqlnd_error_info_init() cannot failNikita Popov2020-12-144-54/+24
| | |
* | | Remove more OOM checksNikita Popov2020-12-142-75/+39
| | |
* | | Remove MYSQLND_STRING_TO_INT_CONVERSION defineNikita Popov2020-12-145-13/+1
| | | | | | | | | | | | | | | This has been unconditionally enabled for a long time already (the actual conversion is behind an additional runtime flag).
* | | MySQLnd: Remove some unnecessary allocator failure checksNikita Popov2020-12-145-70/+7
| | | | | | | | | | | | emalloc/pemalloc are infallible.
* | | MySQLnd: Remove fail thresholds from infallible allocatorsNikita Popov2020-12-143-119/+6
| | | | | | | | | | | | | | | emalloc() etc are infallibe by design. Having a failure threshold for them is a violation of the API contract.
* | | Merge branch 'PHP-8.0'Nikita Popov2020-12-101-0/+7
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #76815
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-101-0/+7
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fixed bug #76815
| | * Fixed bug #76815Nikita Popov2020-12-101-0/+7
| | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-8.0'Nikita Popov2020-12-101-5/+7
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #71145
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-101-5/+7
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fixed bug #71145