Commit Graph

249 Commits

Author SHA1 Message Date
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
Dharman
990bb34891 Handle mysqli errors in more cases
Report errors autocommit, commit, rollback and mysqli_stmt_attr_set.

Additionally, copy the error from conn to stmt when preparing fails,
so these errors are also handled by mysqli_stmt_prepare.

Closes GH-6157.
2020-10-28 11:33:50 +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
Nikita Popov
f684553c2c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix MySQL local infile / attr handling on big endian systems
2020-04-16 11:22:43 +02:00
guirish
a1c1736bfb Fix MySQL local infile / attr handling on big endian systems
Make sure pointer types match what is used by libmysql everywhere.

Closes GH-5380.
2020-04-16 11:22:17 +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
Dmitry Stogov
62fd45f530 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak)
2019-02-12 11:03:55 +03:00
Dmitry Stogov
b6e58dcd22 Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak) 2019-02-12 10:55:05 +03: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
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Andrey Hristov
8975e4dcd7 Simplify the command factory
Since more than an year it not possible to create commands in the heap
but they are allocated on the stack and directly run. In this regard, it
doesn't make sense to have all the vararg stuff. Commands made sense
to be created and pushed onto a stack then a general executor will
run thru the stack and execute/handle the commands.
2019-01-07 18:47:39 +02:00
Nikita Popov
152dc924c5 Drop WE_DONT_COPY_IN_BUFFERED_AND_UNBUFFERED_BECAUSEOF_IS_REF
And perform some code cleanups this allows.
2018-09-22 18:53:32 +02:00
Dmitry Stogov
d0a6b1009f Use zval_ptr_dtor() to replace bound variables (original values nay be circular structures). 2018-07-05 16:46:38 +03:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08: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
69462bdf4c Embeded zend_list into st_mysqlnd_error_info, to avoid extra allocation/deallocation. 2017-11-15 00:53:51 +03:00
Dmitry Stogov
4d5330fbe1 Run mysqlmd commands in one step (without separate create/run/free). 2017-11-14 17:32:41 +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
Xinchen Hui
39327b90e3 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix invalid free of persistent results on error/connection loss in mysqlnd (bug 74376)

Conflicts:
	ext/mysqlnd/mysqlnd_ps.c
2017-04-07 15:20:53 +08:00
Yussuf Khalil
27120d4412 Fix invalid free of persistent results on error/connection loss in mysqlnd (bug 74376) 2017-04-05 20:57:03 +02:00
Nikita Popov
da5e09ad03 Merge branch 'PHP-7.0' into PHP-7.1 2017-01-12 21:15:57 +01:00
rfussenegger
bd75f9e613 Fix bug #69899 2017-01-12 21:13:39 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06: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
Lior Kaplan
3d5438bf7b Merge branch 'PHP-7.0'
* PHP-7.0:
  Update header to PHP Version 7
  Happy new year (Update copyright to 2016)
  Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Xinchen Hui
3aa2182db6 Merge branch 'PHP-7.0' 2015-11-27 15:53:19 +08:00
Xinchen Hui
a347b0be48 Fixed bug #70949 (SQL Result Sets With NULL Can Cause Fatal Memory Errors) 2015-11-27 15:52:55 +08:00
Andrey Hristov
c24d452f60 MNDR:
- less dereferencing in mysqlnd_ps . Dereference stmt->conn only once and
  use a stack variable. Also make the source cleaner.
2015-11-12 16:19:16 +01:00
Andrey Hristov
94ce013bff MNDR:
- remove unused macros
2015-11-12 16:19:16 +01:00
Andrey Hristov
2e3fc57c5c MNDR:
- move things out of mysqlnd_priv.h
2015-11-12 16:19:16 +01:00
Andrey Hristov
c286d7075d MNDR:
- move from char* + len to MYSQLND_STRING
- add some more const modifiers
2015-11-12 16:19:16 +01:00
Andrey Hristov
a530ecff97 MNDR:
- better name for MYSQLND_PPEC - MYSQLND_PFC (protocol frame codec)
2015-11-12 16:19:16 +01:00
Andrey Hristov
654d1a7caf MNDR:
- rename MYSQLND_NET to MYSQLND_PPEC (protocol packet envelope codec).
  PPEC does only the encoding and decoding to the protocol frame.
2015-11-12 16:19:16 +01:00
Andrey Hristov
71e703761f MNDR:
- clean up some things
2015-11-12 16:19:16 +01:00
Andrey Hristov
aa4966d4e3 MNDR:
- now send_command_handle_response() also doesn't depend directly on
  MYSQLND_CONN_DATA
2015-11-12 16:19:16 +01:00
Andrey Hristov
f7a445856d MNDR:
- pass connection closer and its context
- remove unused parameter
2015-11-12 16:19:16 +01:00
Andrey Hristov
280c834c49 MNDR:
- rename the macro for updating the connection state
2015-11-12 16:19:16 +01:00
Andrey Hristov
3eee292669 MNDR:
- Remove the SET_STMT_ERROR macro
2015-11-12 16:19:16 +01:00
Andrey Hristov
4bb784cd0d MNDR:
- make MYSQLND_ERROR_INFO a class
2015-11-12 16:19:16 +01:00
Andrey Hristov
5609eabc6f MDNR:
- make MYSQLND_UPSERT_STATUS more like an object that a simple structure
  Still use macros to make updates simple
2015-11-12 16:19:16 +01:00