Make sure we have a DB connection before setting its charset
This commit is contained in:
parent
bde571728d
commit
e0fb15c185
@ -242,6 +242,7 @@ class Memcached_DataObject extends DB_DataObject
|
||||
if (common_config('db', 'type') == 'mysql' &&
|
||||
common_config('db', 'utf8')) {
|
||||
$conn = $DB->connection;
|
||||
if (!empty($conn)) {
|
||||
if ($DB instanceof DB_mysqli) {
|
||||
mysqli_set_charset($conn, 'utf8');
|
||||
} else if ($DB instanceof DB_mysql) {
|
||||
@ -249,6 +250,8 @@ class Memcached_DataObject extends DB_DataObject
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user