Commit bc9d236d authored by Dries's avatar Dries

- Patch #598586 by grendzy, deekayen: watchdog() assumes is defined.

parent db042d2c
...@@ -138,9 +138,12 @@ function _dblog_get_message_types() { ...@@ -138,9 +138,12 @@ function _dblog_get_message_types() {
* Note some values may be truncated for database column size restrictions. * Note some values may be truncated for database column size restrictions.
*/ */
function dblog_watchdog(array $log_entry) { function dblog_watchdog(array $log_entry) {
// The user object may not exist in all conditions, so 0 is substituted if needed.
$user_uid = isset($log_entry['user']->uid) ? $log_entry['user']->uid : 0;
Database::getConnection('default', 'default')->insert('watchdog') Database::getConnection('default', 'default')->insert('watchdog')
->fields(array( ->fields(array(
'uid' => $log_entry['user']->uid, 'uid' => $user_uid,
'type' => substr($log_entry['type'], 0, 64), 'type' => substr($log_entry['type'], 0, 64),
'message' => $log_entry['message'], 'message' => $log_entry['message'],
'variables' => serialize($log_entry['variables']), 'variables' => serialize($log_entry['variables']),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment