summaryrefslogtreecommitdiff
path: root/classes/Memcached_DataObject.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-06-18 19:19:19 +0000
committerZach Copley <zach@controlyourself.ca>2009-06-18 19:19:19 +0000
commite0fb15c185f4ca81743937c27557c9402ba59071 (patch)
treebe4cd1f247e2c4cad4e271e0c0e2207a9d5b09ee /classes/Memcached_DataObject.php
parentbde571728d5471feeb1d6ae0647b5f09346e6d5c (diff)
Make sure we have a DB connection before setting its charset
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r--classes/Memcached_DataObject.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index 33ac70dd0..f945e94ff 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -242,13 +242,16 @@ class Memcached_DataObject extends DB_DataObject
if (common_config('db', 'type') == 'mysql' &&
common_config('db', 'utf8')) {
$conn = $DB->connection;
- if ($DB instanceof DB_mysqli) {
- mysqli_set_charset($conn, 'utf8');
- } else if ($DB instanceof DB_mysql) {
- mysql_set_charset('utf8', $conn);
+ if (!empty($conn)) {
+ if ($DB instanceof DB_mysqli) {
+ mysqli_set_charset($conn, 'utf8');
+ } else if ($DB instanceof DB_mysql) {
+ mysql_set_charset('utf8', $conn);
+ }
}
}
}
return $result;
}
+
}