Gary Pendergast
8429597071
WPDB: Remove some of the complexities in ::strip_invalid_text()
associated with switching character sets between queries. Instead of trying to dynamically change connection character sets, we now rely on the value of ::charset
. This also fixes the case where queries were being blocked when DB_CHARSET
was utf8
, but the column character set was non-utf8
.
...
Merge of [33308] to the 4.2 branch.
Fixes #32165 .
Built from https://develop.svn.wordpress.org/branches/4.2@33309
git-svn-id: http://core.svn.wordpress.org/branches/4.2@33281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-17 06:38:29 +00:00
Gary Pendergast
19aa985476
WPDB: When checking that text isn't too long to insert into a column, LONGTEXT
columns could fail, as their length is longer than PHP_INT_MAX
. Treating their length as a float
instead of an int
fixes this.
...
Merge of [33276] to the 4.2 branch.
See #32165 .
Built from https://develop.svn.wordpress.org/branches/4.2@33277
git-svn-id: http://core.svn.wordpress.org/branches/4.2@33249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-15 04:40:29 +00:00
Gary Pendergast
c43baf9ef4
WPDB: When extracting the table name from a query, we had a 1000 character limit on the SQL string that would be searched. This was a hangover from when the code was imported from HyperDB, and isn't appropriate for Core, where a wider range of queries are likely to be run.
...
Merges [33259] to the 4.2 branch.
Fixes #32763
Built from https://develop.svn.wordpress.org/branches/4.2@33260
git-svn-id: http://core.svn.wordpress.org/branches/4.2@33232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 10:21:26 +00:00
Dion Hulse
63f64d5909
Enable utf8mb4 for MySQL extension users. Previously utf8mb4 was limited to MySQLi users only unintentionally.
...
Ports [33055] to the 4.2 branch
Fixes #32127 for 4.2.3
Built from https://develop.svn.wordpress.org/branches/4.2@33063
git-svn-id: http://core.svn.wordpress.org/branches/4.2@33034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-03 12:44:28 +00:00
Gary Pendergast
5d957b7c84
WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
...
Merges [32374] to the 4.2 branch.
See #32104 .
Built from https://develop.svn.wordpress.org/branches/4.2@32377
git-svn-id: http://core.svn.wordpress.org/branches/4.2@32347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 07:14:29 +00:00
Gary Pendergast
8c578f0e0c
The UTF-8 regex can occasionally fail on very low memory machines. Reduce the amount of memory it uses.
...
Merges [32375] to the 4.2 branch.
See #32204 .
Built from https://develop.svn.wordpress.org/branches/4.2@32376
git-svn-id: http://core.svn.wordpress.org/branches/4.2@32346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 07:06:29 +00:00
Gary Pendergast
b0b230fab4
WPDB: Allow queries to reference tables in the dbname.tablename
format, and allow table names to contain any valid character, rather than just ASCII.
...
Merge of [32368] to the 4.2 branch.
Props pento, willstedt for the initial patch.
See #32090 .
Built from https://develop.svn.wordpress.org/branches/4.2@32370
git-svn-id: http://core.svn.wordpress.org/branches/4.2@32340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 05:17:30 +00:00
Gary Pendergast
db8f915ee6
WPDB: When checking that a string can be sent to MySQL, we shouldn't use mb_convert_encoding()
, as it behaves differently to MySQL's character encoding conversion.
...
Merge of [32364] to the 4.2 branch.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.
See #32165 .
Built from https://develop.svn.wordpress.org/branches/4.2@32367
git-svn-id: http://core.svn.wordpress.org/branches/4.2@32337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 03:30:30 +00:00
Andrew Nacin
5c2b420b29
WPDB: Sanity check that any strings being stored in the DB are not too long to store correctly.
...
Merge [32299] to the 4.1 and 4.2 branches.
Built from https://develop.svn.wordpress.org/@32307
git-svn-id: http://core.svn.wordpress.org/branches/4.2@32278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-27 15:31:44 +00:00
Gary Pendergast
16bdf0ab2c
WPDB: When sanity checking a string by sending it to MySQL for conversion checks, the incorrect data structure was being returned from wpdb::strip_invalid_text()
, causing all write queries to fail for some character sets when the query contained non-ASCII characters.
...
See #32051 .
Built from https://develop.svn.wordpress.org/trunk@32261
git-svn-id: http://core.svn.wordpress.org/trunk@32232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-22 15:02:28 +00:00
Gary Pendergast
5775586646
WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if the query is entirely ASCII characters.
...
See #32029 .
Built from https://develop.svn.wordpress.org/trunk@32233
git-svn-id: http://core.svn.wordpress.org/trunk@32207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 05:24:26 +00:00
Gary Pendergast
6f38333ab2
WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if it's a query that will never return user data.
...
Fixes #32029 .
Built from https://develop.svn.wordpress.org/trunk@32232
git-svn-id: http://core.svn.wordpress.org/trunk@32206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 05:11:27 +00:00
Gary Pendergast
2bbd21f543
WPDB: When sanity checking read queries, there are some collations we can skip, for improved performance.
...
Props pento, nacin.
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@32162
git-svn-id: http://core.svn.wordpress.org/trunk@32137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-20 04:46:25 +00:00
Dominik Schilling
64fc7294b6
Use HTTPS URLs for codex.wordpress.org.
...
see #27115 .
Built from https://develop.svn.wordpress.org/trunk@32116
git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Drew Jaynes
8f0e359618
Remove unnecessary inline @see
tags from a variety of parameter and return descriptions in wp-includes/wp-db.php.
...
See #31888 .
Built from https://develop.svn.wordpress.org/trunk@32050
git-svn-id: http://core.svn.wordpress.org/trunk@32029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 17:17:27 +00:00
Drew Jaynes
777ad7647c
Remove unnecessary inline @see
tags from the wpdb::process_field_charsets()
DocBlock.
...
See [30345]. See #31888 .
Built from https://develop.svn.wordpress.org/trunk@32049
git-svn-id: http://core.svn.wordpress.org/trunk@32028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 17:15:26 +00:00
Gary Pendergast
6a9d744b42
WPDB: When we check the character set of a column, and find that it's utf8mb4
, we should also check that the current connection supports utf8mb4
. It's possible that the environment may have changed since upgrading the DB, so we can fall back to utf8
when that happens.
...
Fixes #31771 .
Built from https://develop.svn.wordpress.org/trunk@31947
git-svn-id: http://core.svn.wordpress.org/trunk@31926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 02:22:31 +00:00
Gary Pendergast
2a8a5c963a
WPDB: When we're checking to see if the MySQL client library supports utf8mb4
, we need a separate check for mysqlnd
versions, which using different version numbering to libmysqlclient
.
...
Props MattyRob.
Fixes #31644 .
Built from https://develop.svn.wordpress.org/trunk@31939
git-svn-id: http://core.svn.wordpress.org/trunk@31918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-31 09:18:27 +00:00
Gary Pendergast
8c7ffba3b2
WPDB: HHVM doesn't support passing a DB link to mysqli_get_client_version()
. While we usually pass a DB link to every ext/mysql
and mysqli
function call, we don't really need to do that here, as there's no way for the client library to change mid page load.
...
Another fun fact is that `mysql_get_client_version()` doesn't exist, but `mysql_get_client_info()` (along with `mysqli_get_client_info()') do. So, we're switching to them, in order to add a pleasing symmetry to the client version check.
Fixes #31644
Built from https://develop.svn.wordpress.org/trunk@31783
git-svn-id: http://core.svn.wordpress.org/trunk@31763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-15 12:20:26 +00:00
Gary Pendergast
980668299c
WPDB: When checking to see if we can use utf8mb4, we also need to make sure PHP's MySQL client library is capable of using utf8mb4.
...
See #21212
Built from https://develop.svn.wordpress.org/trunk@31391
git-svn-id: http://core.svn.wordpress.org/trunk@31372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 22:28:28 +00:00
Gary Pendergast
04a0e21734
WPDB: The mysqli_query()
call in wpdb::set_charset()
had the parameters the wrong way around.
...
Built from https://develop.svn.wordpress.org/trunk@31374
git-svn-id: http://core.svn.wordpress.org/trunk@31355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 01:26:29 +00:00
Gary Pendergast
55742904c0
WPDB: When we're removing invalid text text from strings with multiple different character sets, wpdb::strip_invalid_text()
wasn't correctly switching connection character sets.
...
Fixes #31262
Built from https://develop.svn.wordpress.org/trunk@31371
git-svn-id: http://core.svn.wordpress.org/trunk@31352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 00:34:25 +00:00
Gary Pendergast
b2cf823105
WPDB: If a site is using the utf8
charset, and their version of MySQL supports utf8mb4
, auto-upgrade them to utf8mb4
.
...
This patch also resizes some indexes, to allow for the 767 byte index size limit in standard MySQL installs.
See #21212
Built from https://develop.svn.wordpress.org/trunk@31349
git-svn-id: http://core.svn.wordpress.org/trunk@31330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-06 04:51:22 +00:00
Drew Jaynes
d7a51b3fc2
Add missing descriptions to the $blogid
and $siteid
property DocBlocks in the wpdb
class.
...
Props ipm-frommen.
See #31008 .
Built from https://develop.svn.wordpress.org/trunk@31294
git-svn-id: http://core.svn.wordpress.org/trunk@31275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-29 11:35:22 +00:00
Gary Pendergast
c777f6a29c
WPDB: When sanity checking a string, check that it's a string, first - PHP notices can occur if an array or object is handled like a string.
...
See #21212
Built from https://develop.svn.wordpress.org/trunk@31094
git-svn-id: http://core.svn.wordpress.org/trunk@31075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 08:45:22 +00:00
Gary Pendergast
83a229084f
WPDB: When wpdb::query()
needs to sanity check a query string, make sure to run wpdb:flush()
afterwards, to ensure the results from sanity check queries aren't mixed up with the results for the user query.
...
See #21212 .
Fixes #30948 .
Built from https://develop.svn.wordpress.org/trunk@31093
git-svn-id: http://core.svn.wordpress.org/trunk@31074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 08:32:22 +00:00
Scott Taylor
60b0cd7943
The keyword elseif
should be used instead of else if
so that all control keywords look like single words.
...
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs.
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31090
git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Gary Pendergast
0e806f1695
WPDB: To ensure we're not asking MySQL to read data using queries that it can't handle, make sure that we run all read queries through the character set sanity checks.
...
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@31051
git-svn-id: http://core.svn.wordpress.org/trunk@31032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-05 04:40:22 +00:00
Gary Pendergast
9704ee2a5c
WPDB Docs: Update the @since version from 4.1.0 to 4.2.0, for all the methods/members that were punted from 4.1.
...
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@31050
git-svn-id: http://core.svn.wordpress.org/trunk@31031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-05 03:51:22 +00:00
Drew Jaynes
7c01a454ce
Improve inline documentation for wpdb::has_cap()
.
...
Adds a changelog entry for the addition of the 'utf8mb4' feature, accepted values for `$db_cap`, and a return description.
Props kpdesign.
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@30768
git-svn-id: http://core.svn.wordpress.org/trunk@30758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 05:23:22 +00:00
Drew Jaynes
23707b1ada
Convert various uses of (optional)
in core parameter descriptions to use the style prescribed in the inline documentation standards for PHP.
...
The style for marking parameters optional in inline PHP docs is: `@param type $var Optional. Description. Accepts. Default.`, where Accepts can be omitted on a case-by-case basis.
Props coffee2code.
Fixes #30591 .
Built from https://develop.svn.wordpress.org/trunk@30753
git-svn-id: http://core.svn.wordpress.org/trunk@30743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-06 21:24:45 +00:00
Gary Pendergast
de6d84935f
WPDB: When looking up the character set for a table or column, make sure we send the table name to MySQL in the correct case, as MySQL can be configured with case sensitive table names.
...
Fixes #30538 .
Built from https://develop.svn.wordpress.org/trunk@30699
git-svn-id: http://core.svn.wordpress.org/trunk@30689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 03:00:23 +00:00
Gary Pendergast
a0c12d0c61
WPDB: Before fetching results, make sure we have a valid result resource to fetch them from.
...
Fixes #27982 .
Built from https://develop.svn.wordpress.org/trunk@30677
git-svn-id: http://core.svn.wordpress.org/trunk@30667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 00:03:22 +00:00
Scott Taylor
b63c789e88
Improve the @param
docs for src/wp-includes/wp-db.php
.
...
See #30224 .
Built from https://develop.svn.wordpress.org/trunk@30664
git-svn-id: http://core.svn.wordpress.org/trunk@30654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 21:55:23 +00:00
Drew Jaynes
9d1a4afda8
4.1 Docs Audit: Improve inline documentation for various wpdb
methods.
...
#30469 .
Built from https://develop.svn.wordpress.org/trunk@30624
git-svn-id: http://core.svn.wordpress.org/trunk@30614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 12:34:25 +00:00
Gary Pendergast
8990b1c1fc
WPDB: Remove the addition of STRICT_ALL_TABLES
, added in [30400]. This proved to be incompatible with too many plugins, as well as being incompatible with MySQL 5.7.
...
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@30587
git-svn-id: http://core.svn.wordpress.org/trunk@30577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-27 11:00:23 +00:00
Drew Jaynes
4b6abbaff4
Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
...
Affects DocBlocks for the following core elements:
* Backtick-escape code snippets in the description for `get_object_taxonomies()`
* Backtick-escape inline code in a markdown-formatted unordered list in the description for `get_taxonomy_labels()`
* Remove an HTML tag from the summary for the `Walker_Category_Checklist` class
* Remove an HTML tag from the summary for `wp_category_checklist()`, various formatting
* Remove an HTML tag from the summary for `wp_terms_checklist()`
* Backtick-escape an HTML tag in the description for `wp_popular_terms_checklist()`
* Remove HTML tags from the summaries for `page_template_dropdown()`, `parent_dropdown()`, and `wp_dropdown_roles()`
* Backtick-escape HTML tags in a parameter description for `add_settings_error()`
* Various formatting in the description and summary for `settings_errors()`
* Markdown-indent code snippets in the descriptions for `wpdb::prepare()`, `wpdb::insert()`, `wpdb::replace()`, `wpdb::update()`, and `wpdb::delete()`
* Backtick-escape an HTML tag in a parameter description for `login_header()`
* Remove HTML tags from the summaries for the `lostpassword_form` and `signup_header` hooks
Props rarst.
See #30473 .
Built from https://develop.svn.wordpress.org/trunk@30546
git-svn-id: http://core.svn.wordpress.org/trunk@30535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 06:31:21 +00:00
Gary Pendergast
f17d168a0f
WPDB: Force STRICT_ALL_TABLES
to be enabled as soon as we connect to the MySQL server.
...
This improves data integrity when inserting and updating rows in the database, particularly when trying to insert emoji into posts stored with character sets that don't support emoji.
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@30400
git-svn-id: http://core.svn.wordpress.org/trunk@30396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 01:46:24 +00:00
Gary Pendergast
739a20a659
WPDB: When a db.php
drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.
...
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@30375
git-svn-id: http://core.svn.wordpress.org/trunk@30372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-18 03:38:23 +00:00
Gary Pendergast
14bf4939e4
WPDB: When removing invalid characters from utf8 strings in older versions of PHP, the regex was too large to be compiled.
...
See #21212
Built from https://develop.svn.wordpress.org/trunk@30366
git-svn-id: http://core.svn.wordpress.org/trunk@30365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-17 11:58:22 +00:00
Gary Pendergast
ecc27d0b27
When creating a post containing emoji, the post can be saved incorrectly if MySQL isn't using a character set that supports emoji.
...
This change prevents the save from occurring, so it can be handled correctly in the UI.
See #21212 .
Built from https://develop.svn.wordpress.org/trunk@30345
git-svn-id: http://core.svn.wordpress.org/trunk@30344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-14 21:28:22 +00:00
Gary Pendergast
21467af4db
wpdb: When flushing results on a mysqli connection, make sure that wpdb::$dbh
is a valid mysqli connection handle.
...
Fixes a unit test failure introduced in [30297].
Fixes #28155 .
Props soulseekah.
Built from https://develop.svn.wordpress.org/trunk@30299
git-svn-id: http://core.svn.wordpress.org/trunk@30298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 02:17:28 +00:00
Gary Pendergast
0013150649
wpdb::flush()
was not flushing results correctly when using mysqli.
...
This change also allows stored procedures or queries made with `mysqli_multi_query()` to be flushed.
Includes unit tests.
Fixes #28155 .
Props soulseekah.
Built from https://develop.svn.wordpress.org/trunk@30297
git-svn-id: http://core.svn.wordpress.org/trunk@30296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-10 05:40:23 +00:00
Gary Pendergast
f572927353
WPDB's __get()
function should perform strict comparisons against member names
...
Built from https://develop.svn.wordpress.org/trunk@30292
git-svn-id: http://core.svn.wordpress.org/trunk@30291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-09 12:04:23 +00:00
Drew Jaynes
f8657d5890
Remove redundant and erroneous @uses
tag from most core inline documentation.
...
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.
Fixes #30191 .
Built from https://develop.svn.wordpress.org/trunk@30105
git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Sergey Biryukov
bf856e3a62
Translate some previously untranslated _doing_it_wrong() messages.
...
props georgestephanis.
fixes #25614 .
Built from https://develop.svn.wordpress.org/trunk@29840
git-svn-id: http://core.svn.wordpress.org/trunk@29604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 21:06:15 +00:00
Mark Jaquith
0d3b83551f
Use HTTPS URLs for core.trac.wordpress.org
...
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788
git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Sergey Biryukov
740df917fa
Remove unnecessary semicolon.
...
props ixkaito.
fixes #29784 .
Built from https://develop.svn.wordpress.org/trunk@29784
git-svn-id: http://core.svn.wordpress.org/trunk@29556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 10:30:16 +00:00
Andrew Nacin
53f1ba51e4
DB: Revert [28814] and require a WHERE for wpdb::update().
...
see #26106 .
Built from https://develop.svn.wordpress.org/trunk@29664
git-svn-id: http://core.svn.wordpress.org/trunk@29438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 04:56:15 +00:00
Drew Jaynes
3665b5a1a1
Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
...
See #22234 and #28885 .
Built from https://develop.svn.wordpress.org/trunk@29165
git-svn-id: http://core.svn.wordpress.org/trunk@28949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:12:14 +00:00