theme('username', drupal_anonymous_user())

produces the notice above because the name member is not set.

I propose adding the highlighted line below:

function drupal_anonymous_user($session = '') {
  $user = new stdClass();
  $user->uid = 0;
  $user->name = '';           // Can we add this line?
  $user->hostname = ip_address();
  $user->roles = array();
  $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
  $user->session = $session;
  $user->cache = 0;
  return $user;
}
CommentFileSizeAuthor
#1 drupal_anonymous_user.1185666.1.patch449 bytessalvis
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

salvis’s picture

Status: Active » Needs review
FileSize
449 bytes

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.