Commit bfee7d05 authored by catch's avatar catch

Issue #598586 by grendzy, deekayen, matglas86, dawehner: Fixed watchdog() assumes is defined.

parent a3d299b8
......@@ -1585,6 +1585,9 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
if (!$in_error_state && function_exists('module_implements')) {
$in_error_state = TRUE;
// The user object may not exist in all conditions, so 0 is substituted if needed.
$user_uid = isset($user->uid) ? $user->uid : 0;
// Prepare the fields to be logged
$log_entry = array(
'type' => $type,
......@@ -1593,6 +1596,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
'severity' => $severity,
'link' => $link,
'user' => $user,
'uid' => $user_uid,
'request_uri' => $base_root . request_uri(),
'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
'ip' => ip_address(),
......
......@@ -2147,7 +2147,7 @@ function theme_item_list($variables) {
// Only output the list container and title, if there are any list items.
if ($output !== '') {
if ($title !== '') {
if (!empty($title)) {
$title = '<h3>' . $title . '</h3>';
}
$output = '<div class="item-list">' . $title . $output . '</div>';
......
......@@ -140,12 +140,9 @@ function _dblog_get_message_types() {
* Note some values may be truncated for database column size restrictions.
*/
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')
->fields(array(
'uid' => $user_uid,
'uid' => $log_entry['uid'],
'type' => substr($log_entry['type'], 0, 64),
'message' => $log_entry['message'],
'variables' => serialize($log_entry['variables']),
......
......@@ -107,6 +107,7 @@ class DBLogTestCase extends DrupalWebTestCase {
'severity' => $severity,
'link' => NULL,
'user' => $this->big_user,
'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0,
'request_uri' => $base_root . request_uri(),
'referer' => $_SERVER['HTTP_REFERER'],
'ip' => ip_address(),
......@@ -388,6 +389,7 @@ class DBLogTestCase extends DrupalWebTestCase {
'severity' => WATCHDOG_NOTICE,
'link' => NULL,
'user' => $this->big_user,
'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0,
'request_uri' => $base_root . request_uri(),
'referer' => $_SERVER['HTTP_REFERER'],
'ip' => ip_address(),
......
......@@ -66,6 +66,7 @@ function watchdog_skip_semaphore($type, $message, $variables = array(), $severit
'severity' => $severity,
'link' => $link,
'user' => $user,
'uid' => isset($user->uid) ? $user->uid : 0,
'request_uri' => $base_root . request_uri(),
'referer' => $_SERVER['HTTP_REFERER'],
'ip' => ip_address(),
......
......@@ -109,7 +109,7 @@ function syslog_watchdog(array $log_entry) {
'!ip' => $log_entry['ip'],
'!request_uri' => $log_entry['request_uri'],
'!referer' => $log_entry['referer'],
'!uid' => $log_entry['user']->uid,
'!uid' => $log_entry['uid'],
'!link' => strip_tags($log_entry['link']),
'!message' => strip_tags(!isset($log_entry['variables']) ? $log_entry['message'] : strtr($log_entry['message'], $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