[wp-trac] [WordPress Trac] #38921: Defining filter pre_get_table_charset causes errors

WordPress Trac noreply at wordpress.org
Wed May 27 08:29:22 UTC 2020


#38921: Defining filter pre_get_table_charset causes errors
--------------------------------------+-----------------------------
 Reporter:  haoran                    |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Database                  |     Version:  4.2
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------

Comment (by kovshenin):

 Yeah, definitely a bug.

 I have a table with some ascii columns and a couple of utf8mb4 columns,
 and the default wpdb behavior treats my entire table as ascii, so I get
 the `CONVERT(CONVERT())` bullet when inserting into my utf8mb4 column via
 `strip_invalid_text()`. That `pre_get_table_charset` filter's definitely a
 life saver for me and did exactly what I expected it to do, though I was a
 bit sad about a whole bunch of warnings from `get_col_charset()`.

 A workaround is to filter `pre_get_col_charset` as well.

 The patch from @birgire looks good though.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/38921#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list