diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 3206063a3a..11c4673074 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1233,6 +1233,7 @@ class wpdb { $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting $query = preg_replace( '|(?prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] ); + $length = sprintf( '%.0f', $value['length']['length'] ); + $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), $length ) USING {$this->charset} )", $value['value'] ); } else if ( 'binary' !== $charset ) { // If we don't have a length, there's no need to convert binary - it will always return the same result. $queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING {$this->charset} )", $value['value'] );