Commit Graph

324 Commits

Author SHA1 Message Date
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
Nikita Popov
f365d0e00e Fix mysqlnd memory leak
The actual leak is observed in ext/pdo_mysql/tests/bug_74376.phpt.
The persistent connection leaks because a refcount decrement on a
result is missed. The refcount decrement is missed because
free_result_contents is used, rather than free_result.

Looking at other uses of free_result_contents, it looks like they
could also suffer from this problem. Apart from one case,
free_result_contents is always used to release the result entirely
(I've adjusted the one differing case to only free meta), so I'm
moving most of the logic from free_result into free_result_contents.
The only difference is now that free_result will skip_result first.
2019-06-28 09:18:32 +02:00
Nikita Popov
e1e275eefd Fix mysqlnd printf modifiers
By moving the the standard macros...
2019-06-12 13:17:25 +02:00
Nikita Popov
2856afc70e Make "MySQL server has gone away" errors more consistent
Don't generate explicit warnings for these in two places, use usual
error handling mechanism. Additionally suppress a number of warnings
if the server has gone away.
2019-06-03 14:27:47 +02:00
Nikita Popov
71ce7d32ea Merge branch 'PHP-7.3' into PHP-7.4 2019-05-23 13:41:17 +02:00
Nikita Popov
6f9dfd9473 Fix bug #77955
Free metadata before freeing the arena. I don't have a repro script,
but the added assertion fails for many existing tests prior to this
change.
2019-05-23 13:40:52 +02:00
Nikita Popov
197b0373f6 Merge branch 'PHP-7.3' into PHP-7.4 2019-03-22 13:07:11 +01:00
Nikita Popov
30ddfd49ed Fixed bug #77773 2019-03-22 13:07:00 +01:00
Nikita Popov
8c2288bb0a Merge branch 'PHP-7.3' into PHP-7.4 2019-02-21 13:46:31 +01:00
Nikita Popov
e5d8ac92a4 Merge branch 'PHP-7.2' into PHP-7.3 2019-02-21 13:45:53 +01:00
Nikita Popov
934691fabb Fixed bug #77597
The same variable was reused in two nested loops... The test doesn't
fail on 7.2, but I'm fixing this here anyway as the code is clearly
wrong, and probably erroneous in other situations.
2019-02-21 13:42:47 +01:00
Peter Kokot
c245898bfa Update and fix remaining year ranges (2019)
This patch follows previous license year ranges updates. With new
approach source code files now have simplified headers with license
information without year ranges.
2019-02-08 23:14:29 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Dmitry Stogov
ccdd8d6a3c Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77308 (Unbuffered queries memory leak)
2019-01-14 13:59:58 +03:00
Dmitry Stogov
1a306cc9a1 Fixed bug #77308 (Unbuffered queries memory leak) 2019-01-14 13:59:30 +03:00
Andrey Hristov
d12443efc7 Const changes 2019-01-07 20:16:33 +02:00
Dmitry Stogov
e8a04b387e Allocate array of proper size 2018-07-18 14:49:52 +03:00
Dmitry Stogov
5f83904a5d Use zval_ptr_dtor_nogc() instead of zval_dtor() inplaces where circular-references are not possible 2018-07-05 15:25:55 +03:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Dmitry Stogov
4ad9cf4605 Bit test optimization 2018-05-08 11:58:17 +03:00
Dmitry Stogov
c88be6aee1 Bit check micro-optimization 2018-04-28 14:13:12 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Dmitry Stogov
7067f7ccb4 Fixed incorrect buffer reallocation 2017-11-30 13:54:24 +03:00
Dmitry Stogov
6bcace1b72 Use single memory pool for result metadata and result set. 2017-11-15 14:07:09 +03:00
Dmitry Stogov
e2c9dfb5de Cleanup. Make difference between MYSQLND_ROW_BUFFER and MYSQLND_MEMORY_POOL_CHUNK (the last one is completely removed). 2017-11-15 11:33:32 +03:00
Dmitry Stogov
de5cc9017e Use better buffer reallocation strategy 2017-11-15 02:44:34 +03:00
Dmitry Stogov
492bc8ea57 Use mnd_emalloc/mnd_efree 2017-11-14 23:34:06 +03:00
Dmitry Stogov
f1f1f63ce1 Reimplemented MYSQLND_MEMORY_POOL to avoid allocations ouside of pool. Store all data related to result set in the pool. 2017-11-14 23:08:29 +03:00
Dmitry Stogov
3077a14aea Use mnd_erealloc() 2017-11-14 16:19:44 +03:00
Dmitry Stogov
148641980c Merge mysqlnd_field_hash_key structure into st_mysqlnd_field. 2017-11-14 16:14:13 +03:00
Dmitry Stogov
93334b5fc2 Use stack-allocated packets. 2017-11-14 15:10:27 +03:00
Dmitry Stogov
a7305eb539 Made "result", "statement" and "last_message" to always use Zend MM heap. (even for persistent connections these entities don't relive request boundary) 2017-11-02 03:27:25 +03:00
Dmitry Stogov
e111bccd48 Use zval_ptr_dtor_nogc() for data that can't be circular 2017-06-29 12:14:41 +03:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Andrey Hristov
675fc9e04e Merge branch 'PHP-7.1' 2016-12-12 22:00:30 +02:00
Andrey Hristov
9eca4dca73 Optimized memory handling of BIT fields. Less memory copies and less
memory usage.
2016-12-12 21:59:29 +02:00
Anatol Belski
b204b3abd1 further normalizations, uint vs uint32_t
fix merge mistake

yet one more replacement run
2016-11-26 17:29:01 +01:00
Andrey Hristov
b27ff62ee0 Fix for bug #71863 Segfault when EXPLAIN with "Unknown column" error
The reason was that after the big refactoring of mysqlnd at the end of
last year code that is initializing the error_info structure in the
result set was not added. It existed already for connections and PS.
The code that segfaults is hit only with MariaDB because MariaDB sends
full metadata about the EXPLAIN query + EOF packet and only then it sends
an error packet. MySQL doesn't do that but sends directly an error which
is caught (by different code path). As errors during execution (which means
after sending meta) are pretty rare there was no test case of MySQL to
catch it.
2016-07-25 21:59:27 +02:00
Andrey Hristov
671d22f5de Fix for bug #71863 Segfault when EXPLAIN with "Unknown column" error
The reason was that after the big refactoring of mysqlnd at the end of
last year code that is initializing the error_info structure in the
result set was not added. It existed already for connections and PS.
The code that segfaults is hit only with MariaDB because MariaDB sends
full metadata about the EXPLAIN query + EOF packet and only then it sends
an error packet. MySQL doesn't do that but sends directly an error which
is caught (by different code path). As errors during execution (which means
after sending meta) are pretty rare there was no test case of MySQL to
catch it.
2016-07-23 00:26:26 +03:00
Kalle Sommer Nielsen
bb198ec9a6 Fix compiler warnings in mysqlnd 2016-04-03 02:27:25 +02:00
Andrey Hristov
3a33ee63e8 Merge branch 'PHP-7.0' 2016-03-16 10:47:27 +01:00
Andrey Hristov
f2ab731a8c Fix emails in headers. @mysql.com addresses are no more since many years. 2016-03-16 10:24:52 +01:00
Nikita Popov
2d1559f827 Move free_chunk and resize_chunk into memory pool
Drops 24 bytes from each chunk. For the example in bug #71468 it
reduces memory usage by 30%.
2016-02-22 19:40:32 +01:00