Skip to content
Snippets Groups Projects
Commit bc9d236d authored by Dries Buytaert's avatar Dries Buytaert
Browse files

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

parent db042d2c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -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']),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment