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.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt. See #32165. Built from https://develop.svn.wordpress.org/trunk@32364 git-svn-id: http://core.svn.wordpress.org/trunk@32335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -527,7 +527,7 @@ function upgrade_all() {
|
||||
if ( $wp_current_db_version < 31351 )
|
||||
upgrade_420();
|
||||
|
||||
if ( $wp_current_db_version < 32308 )
|
||||
if ( $wp_current_db_version < 32364 )
|
||||
upgrade_430();
|
||||
|
||||
maybe_disable_link_manager();
|
||||
@@ -1446,17 +1446,33 @@ function upgrade_420() {
|
||||
function upgrade_430() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 32308 ) {
|
||||
if ( $wp_current_db_version < 32364 ) {
|
||||
$content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
|
||||
if ( ! $content_length ) {
|
||||
$content_length = 65535;
|
||||
if ( false === $content_length ) {
|
||||
$content_length = array(
|
||||
'type' => 'byte',
|
||||
'length' => 65535,
|
||||
);
|
||||
} elseif ( ! is_array( $content_length ) ) {
|
||||
$length = (int) $content_length > 0 ? (int) $content_length : 65535;
|
||||
$content_length = array(
|
||||
'type' => 'byte',
|
||||
'length' => $length
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'byte' !== $content_length['type'] ) {
|
||||
// Sites with malformed DB schemas are on their own.
|
||||
return;
|
||||
}
|
||||
|
||||
$allowed_length = intval( $content_length['length'] ) - 10;
|
||||
|
||||
$comments = $wpdb->get_results(
|
||||
"SELECT comment_ID FROM $wpdb->comments
|
||||
WHERE comment_date_gmt > '2015-04-26'
|
||||
AND CHAR_LENGTH( comment_content ) >= $content_length
|
||||
AND ( comment_content LIKE '%<%' OR comment_content LIKE '%>%' )"
|
||||
"SELECT `comment_ID` FROM `{$wpdb->comments}`
|
||||
WHERE `comment_date_gmt` > '2015-04-26'
|
||||
AND LENGTH( `comment_content` ) >= {$allowed_length}
|
||||
AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )"
|
||||
);
|
||||
|
||||
foreach ( $comments as $comment ) {
|
||||
|
||||
Reference in New Issue
Block a user