Commit Graph

367 Commits

Author SHA1 Message Date
Christoph M. Becker
a3dbd39be0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15432: Heap corruption when querying a vector
2024-08-20 15:44:40 +02:00
Christoph M. Becker
b1211c1e4a
Fix GH-15432: Heap corruption when querying a vector
Since the mysqlnd result set is arena allocated, we must not simply
free it, but rather call the appropriate `free_result` method.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2024-08-20 15:43:21 +02:00
Kamil Tekiela
05efcc245e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Clear mysql error in fetch_into
2024-05-17 13:13:18 +02:00
Kamil Tekiela
a59868aef8
Clear mysql error in fetch_into
Closes GH-14256
2024-05-17 13:08:42 +02:00
Jakub Zelenka
fbcad699cb
Merge branch 'PHP-8.2' into PHP-8.3 2024-04-12 10:57:42 +01:00
Jakub Zelenka
3b93f13199
Revert "ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT"
This reverts commit 5035b85090.

This broke Doctrine DBAL tests - more discussion in GH-13618.
2024-04-12 10:56:09 +01:00
Kamil Tekiela
acf9047346
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
2024-04-10 13:35:14 +02:00
Appla
5035b85090
ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
Closes GH-13618.
2024-04-10 13:33:04 +02:00
Niels Dossche
3269aa95cb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
2023-11-27 14:02:19 +01:00
Niels Dossche
6a914cb7a5 Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
Closes GH-12794.
2023-11-27 14:01:46 +01:00
Niels Dossche
f8bfc0e373 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Avoid using uninitialised struct
2023-11-25 20:08:26 +01:00
Niels Dossche
ebb4488def Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Avoid using uninitialised struct
2023-11-25 20:08:01 +01:00
Mikhail Galanin
7e7817bc2f Avoid using uninitialised struct
Closes GH-12046.
2023-11-25 20:07:14 +01:00
Kamil Tekiela
788540ef2c
Remove remnant of COM_FIELD_LIST 2023-08-10 00:38:37 +01:00
Kamil Tekiela
82934746b7
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:54:30 +01:00
Kamil Tekiela
4db701c049
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:31:18 +01:00
Yurun
ca5d48213a
Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
Closes GH-11551.
2023-08-04 22:25:01 +01:00
Javier Eguiluz
732d92c0e5
[skip ci] Fix various typos and grammar issues (#11143) 2023-04-28 11:05:32 +02:00
Kamil Tekiela
885dca3762 Remove mysqlnd_unbuffered_skip_result and voidify skip_result 2021-10-22 11:10:53 +01:00
Nikita Popov
d001682ac4 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug #81494
2021-10-08 15:02:29 +02: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
Kamil Tekiela
d902b3a844
Replace macro with inline function (#7365) 2021-08-13 20:03:26 +01:00
Nikita Popov
c492c90a6e Fix mysqlnd debug formats on 32-bit 2021-06-16 17:08:20 +02:00
Nikita Popov
3acdab864d Fix printf formats in mysql debug logging
Enable printf format verification and fix the reported errors.
2021-06-16 16:09:06 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
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.
2021-01-15 12:33:06 +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
33e904915e MySQLnd: Clean up and optimize mysqlnd result set handling
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.
2020-12-17 10:15:02 +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
806465892e MySQLnd: Drop free_result_internal
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.
2020-12-15 12:35:58 +01:00
Nikita Popov
6bda0c14f5 MySQLnd: Simplify management of zval row buffer
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.
2020-12-15 12:00:05 +01:00
Nikita Popov
362c29241d Remove mysqlnd_extension enum
ext/mysql is no longer supported, drop handling for it from
mysqlnd.
2020-12-15 10:55:53 +01:00
Nikita Popov
be4f73f328 MySQLnd: Remove unused fetch_field_data method
This method is not used, and is implemented in a very dubious
way.
2020-12-15 10:47:39 +01:00
Nikita Popov
3c63b26b6d Use zmm for row_c data
This API already doesn't match libmysqlclient, so we may as well
use the zmm.
2020-12-14 13:43:30 +01:00
Nikita Popov
7088cffe8a mysqlnd_error_info_init() cannot fail 2020-12-14 12:31:45 +01:00
Nikita Popov
35d752f4fc Remove more OOM checks 2020-12-14 12:28:26 +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
d784c65cca Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Retain QUIT_SEND connection state
2020-10-29 10:39:58 +01:00
Nikita Popov
24537a73c0 Retain QUIT_SEND connection state
If the server goes away while reading a packet, don't go back into
the READY state. This will just cause broken pipe errors down the
line.
2020-10-29 10:36:03 +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
George Peter Banyard
01957adb7f Fix [-Wmissing-field-initializers] compiler warning in mysqlnd_result.c
Explicitly initialize to NULL the unused pointers to preserve
ABI forwards compatibility.
2020-02-10 12:14:47 +01:00
Christoph M. Becker
8ea190ba95 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:24:12 +01:00
Christoph M. Becker
b0cdd8cc53 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:23:12 +01:00
Christoph M. Becker
1752393bb4 Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
Column names can be numeric strings, so we have to make sure to insert
the column values with the appropriate numeric keys, instead of adding
them.
2020-01-13 13:21:45 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
c25104bb5b Merge branch 'PHP-7.3' into PHP-7.4 2019-09-13 14:37:15 +02:00
Nikita Popov
df982da587 Fix bug #78525
When calling free_result_buffers(), also free field metadata and
restore the mempool state to what it was before any allocations
have been made. Remove the mempool save/restore logic for the
inner result set as this is now handled on a higher level.
2019-09-13 14:37:03 +02:00