function openid_profile_preprocess_user_picture(&$variables) {
  $variables['picture'] = '';
  if (variable_get('user_pictures', 0)) {
    $account = $variables['account'];
    if (!empty($account->picture) && file_exists($account->picture)) {
      $picture = file_create_url($account->picture);
    }
    // Add support for external user pictures
    elseif (!empty($account->picture) && valid_url($account->picture)) {
      $picture = $account->picture;
    }
    elseif (variable_get('user_picture_default', '')) {
      $picture = variable_get('user_picture_default', '');
    }

If you have a proper user picture, $account->picture is a file stdClass, not just a string, so you actually get a notice back:

Warning: file_exists() expects parameter 1 to be string, object given in openid_profile_preprocess_user_picture() (line 463 of sites/all/modules/contrib/openid_profile/openid_profile.module).
Warning: preg_match() expects parameter 2 to be string, object given in valid_url() (line 1148 of includes/common.inc).

Comments

Oleksa-1’s picture

any solution how to get rid of this warning?

ijhaas’s picture

No solution yet?
How can I make a string of $account->picture in file_exists($account->picture))
or is it better to replace file_exists() by is_file()

  • sanduhrs committed 83d8ffe on 7.x-1.x
    Issue #1471774: openid_profile_preprocess_user_picture expects user...
sanduhrs’s picture

Issue summary: View changes
Status: Active » Fixed

Should be fixed, thanks for reporting.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.