[wp-trac] [WordPress Trac] #37683: $collate and $charset can be undefined in wpdb::init_charset()

WordPress Trac noreply at wordpress.org
Sun Aug 21 12:39:42 UTC 2016


#37683: $collate and $charset can be undefined in wpdb::init_charset()
-------------------------------------+-----------------------
 Reporter:  robsat91                 |       Owner:  pento
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.6.1
Component:  Database                 |     Version:  4.6
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:
-------------------------------------+-----------------------
Changes (by pento):

 * keywords:  has-patch => has-patch needs-refresh


Comment:

 Thanks for the patch, @Frozzare!

 I think a better solution would be to set `$charset` and `$collate` to
 empty strings at the start of `::init_charset()`. `::determine_charset()`
 should be called, even when `$collate` is not set, as the collation can
 change based on the charset. It doesn't really matter either way if the
 method is called when `$charset` is empty, I'm inclined to call it just to
 not increase code complexity.

 Also, `$this->charset` and `$this->collate` need to be set, even when the
 local vars are empty, or similar warnings will occur in `::set_charset()`.

 Finally, a note to committers: please don't commit any patches on this
 ticket without my review - #37689 may be related, which I'm currently
 investigating. The outcome of that ticket may have an effect on the best
 solution for this ticket.

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


More information about the wp-trac mailing list