I have a few sites running messaging/notifications and all of them are sometimes sending notifications that just have 'n/a' where the body of the node/comment should be. Originally I thought it was a mail2web issue (#349730: Notifications sometimes Blank), but I have a new site that isn't using mail2web and it's happening as well. Some folks on that mail2web issue figured out that it was an input filter issue for them. I went digging around and the function check_markup() in filter.module will default to 'n/a' if the test (isset($text) && (!$check || filter_access($format))) fails.

The only place I can find that uses check_markup() is here:

function messaging_text_render($text, $glue = '', $filter = NULL) {
  $output = '';

  if (is_array($text)) {
    if (isset($text['#prefix'])) {
      $output .= $text['#prefix'].$glue;
      unset($text['#prefix']);
    }
    if (isset($text['#text'])) {
      $output .= $text['#text'];
      return $output;
    }
    foreach (element_children($text) as $key) {
      // The filter is not passed along
      $text[$key] = messaging_text_render($text[$key], $glue);
    }
    $output .= implode($glue, $text);
  } else {
    $output .= $text;
  }
  // The filter is applied now only once
  if ($filter) {
    $output = check_markup($output, $filter, FALSE);
  }
  return $output;
}

Could something about the recursive function be confusing the check_markup call near the end?

The most annoying part about this bug for me is that I can't reproduce it myself but it keeps happening on my sites, so it's making it hard to narrow down what's going on.

Comments

cglusky’s picture

I am one of those people on the mail2web queue and I continue to fight with this issue.

I have narrowed it down (I think) to only happening when there are multiple mails to retrieve/process in one TIMED cron run.

If I retrieve manually by clicking "retrieve" for the mailbox in the mailhandler admin interface OR I run cron via Admin Menu (so via menu callback) I am not seeing the n/a issue. EVEN with multiple emails to fetch.

There are many variables in play (as you pointed out in your issue). I will keep you posted on what I find.

Can you confirm if it's only repeatable with multiple emails on a timed cron???

Thanks,
Coby

cglusky’s picture

OK. I tried setting my Messaging "Mail" method filter to "None (insecure)" and I still get n/a in the body. Perhaps the $filter check needs to check for != "None" ???

I am running D6.9 with:
messaging - dev version from around Dec 26
notifications - dev version from around Dec 26
mailhandler - 6.x-1.5
mail2web - my own patched up version from #351260: Proposed Changes For D6 Version
Markdown Filter - latest stable
Reverse Markdown Filter - My own hack

Plain text in and out using simple mail via Drupal's mali function.

I did get it fixed but I am still scratching my head. I had to pass [comment-body-raw] token instead of [comment-body] which could mean that the comment context was not set during cron??? I do not fully understand the bootstrap process that gets called there, so have no idea if it could be something like a module weight issue. Or there was some text cleaning functions that did not like each other. No errors, just "n/a" and it only happened when timed cron was parsing more than two emails that mail2web was handling as comments. And you say you are getting it without mail2web, so go figure.

Still a great set of modules and much need capability, but what a long month it's been.

R,
Coby

jose reyero’s picture

Status: Active » Closed (duplicate)

Looks like it's the same issue as this one, #350673: Missing Parts to Messages