hello,

i have a drupal site, with basicly the support module, as an internal organisation tool. when posting a comment on a support ticket, there is an option to notify via emails. those email, are going encrypted, but drupal keeps giving us this error:

pdt1: recoverable fatal error: Object of class stdClass could not be converted to string in PATH/to/DRUPAL/modules/openpgp/openpgp_gpg/openpgp_gpg.inc on line 217.

any ideas?

CommentFileSizeAuthor
#6 openpgp-1024360-6.patch554 bytessmscotten

Comments

olak’s picture

Status: Active » Closed (fixed)

update: just got the hang of it. the error occurs if someone from the subscribed-to-be-notified users doesnt have a valid pgp key

fonant’s picture

Status: Closed (fixed) » Active

I still get this, it isn't fixed in 6.x-1.0-beta1 if the recipient has an empty PGP key.

fonant’s picture

The problem appears to be fixed by changing:

        else if (!is_null($v)) {
          $result .= ' --' . $k . ' ' . escapeshellarg((string)$v);
        }

to this:

        else if (!is_null($v)) {
          // convert object recipient into recipient email string
          if (is_object($v)) {
           $v = $v->mail;
          }
          $result .= ' --' . $k . ' ' . escapeshellarg((string)$v);
        }

The code seems to be expecting "recipient" to have a value that can be cast to a string, when in my case it's an object with the recipient email address as its mail attribute.

fonant’s picture

This code in openpgp_mail_parse_recipients() sets a recipient to be either a user object, or an email address.

    if (($account = user_load(array('mail' => $recipient)))) {
      $recipients[$account->uid] = $account;
    }
    else {
      $recipients[$recipient] = $recipient; // TODO: look it up on the keyservers?
    }

Do we need the whole user $account? Why are we loading a user if one matches an email address? Ah, of course, so we can look for their PGP key data in their profile later.

smscotten’s picture

#3 fixed it for me in the 7.x port as well.

smscotten’s picture

Status: Needs review » Active
StatusFileSize
new554 bytes

For what it is worth, here's fonant's fix in a patch for d6.

smscotten’s picture

Status: Active » Needs review

Status: Active » Needs review