Object of class stdClass could not be converted to string in .../public_html/modules/pathauto/pathauto.inc on line 147.

This has only started to happen since I upgraded CCK to 1.9, but I wasn't sure where or how to address it.

These are the lines in question in Pathauto:

  foreach ($punctuation as $name => $details) {
    $action = variable_get('pathauto_punctuation_'. $name, 0);
    // 2 is the action for "do nothing" with the punctuation
    if ($action != 2) {
      // Slightly tricky inline if which either replaces with the separator or nothing
      $output = str_replace($details['value'], ($action ? $separator : ''), $output); //Line 147
    }
  }

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

Does it happen for all content types or only for a specific content type? What are the cck fields on the content types impacted.

Can you do some debugging and print out the $output, $details['value'], $action, and $separator right before line 147? Do something like

drupal_set_message(print_r($variable_name, TRUE));

For each variable. That should help identify which variable is an object and causing the problem.

greggles’s picture

Title: Log errors about pathauto_cleanstring » pathauto_cleanstring Object of class stdClass could not be converted to string in pathauto.inc line 147

Easier to find title...

icecreamyou’s picture

I'm pretty short on time right now, but will try to do the debugging soon - if not today then within a few days.

If it makes any difference, I'm also getting this error (though less frequently) for token.module line 188:

function _token_replace_tokens($original, $tokens, $values, $leading, $trailing) {
  $tokens = token_prepare_tokens($tokens, $leading, $trailing);
  return str_replace($tokens, $values, $original); //line 188
}

...I don't know if that tells you anything.

It's also difficult to debug because I don't know when/how this is happening.

icecreamyou’s picture

Title: pathauto_cleanstring Object of class stdClass could not be converted to string in pathauto.inc line 147 » Object of class stdClass could not be converted to string
Project: Pathauto » Content Construction Kit (CCK)
Version: 5.x-2.3 » 5.x-1.9
Component: Code » General
Status: Postponed (maintainer needs more info) » Active

Getting the same message for relatedlinks so I'm moving this to CCK, because I've only had this error since I upgraded to 1.9.

yched’s picture

Status: Active » Postponed (maintainer needs more info)

The information asked by greggles in #1 would still be useful.

icecreamyou’s picture

Well, I don't have time to debug right now, and my site is live so it could produce complications. But what I do know is not very helpful: I get the message on any user profile-related page or any node-related page. But it doesn't happen on every visit to any given page - just sometimes, at apparently random times.

greggles’s picture

There are basically three ways that bugs like this get "fixed":

1) Someone else is also struck by it (and maybe many more people are) and then with the commonalities in the setups and the debugging information one of them provides it is fixed
2) The original poster provides the debugging information required
3) After 2 weeks of sitting "needs more info" it gets marked as "closed" and the problem never actually goes away :(

I'm just relating that in case you were unaware.

icecreamyou’s picture

I know. I've been *really* busy this week though. It might be Friday afternoon before I can debug... sorry for the delay. :-/

I did discover, however, that the error only occurs for logged-in users.

icecreamyou’s picture

I won't have time to debug this, so I'm closing the issue. If I ever figure out what the problem actually is I'll reopen it.

icecreamyou’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)