[wp-trac] [WordPress Trac] #38921: Defining filter pre_get_table_charset causes errors
WordPress Trac
noreply at wordpress.org
Wed Nov 23 23:17:47 UTC 2016
#38921: Defining filter pre_get_table_charset causes errors
--------------------------+-----------------------------
Reporter: haoran | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In wp-db.php::get_table_charset(), a filter is defined,
'''pre_get_table_charset'''.
However, if this filter is defined, wp-db.php::get_col_charset() throws
errors. This is because the latter assumes that it can find cached results
cached in:
{{{
$this->table_charset[];
}}}
The assumption seems to be that if you add the '''pre_get_table_charset'''
filter, you will also define the '''pre_get_col_charset''' filter.
Code reference: [https://github.com/WordPress/WordPress/blob/master/wp-
includes/wp-db.php#L2437]
Note: defining this filter lets you hard-code the charset of tables,
rather than doing a database lookup every time. This can be done quite
safely because the most recent upgrade forced our DB tables to be
'''utf8mb4'''.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38921>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list