HaLe Blog twitter
HaLe Blog Rss

Drupal 6 bootstrap error in bootstrap line 771 and 768

Posted by lhe | Posted in Content Management Systems, Drupal | Posted on 30-07-2009

7

While working on a Drupal site, we kept getting error messages after deleting content:

•	recoverable fatal error: Object of class stdClass could not be 
converted to string in /usr/local/drupal/includes/bootstrap.inc on line 768. • warning: preg_match() expects parameter 2 to be string, object given
in /usr/local/drupal/includes/bootstrap.inc on line 771.

after that we got a similar error but on line 735

we looked around for a bit and fixed it. we edited the bootstrap file, which is actually not done. if anyone found a better way to fix this issue, please comment on this post.

Anyway, this is what the bootstrap looks like now:

we changed lines 734 – 739:

function check_plain($text) {
 if(!is_string($text)){
 return "";
 }
 return drupal_validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
}

and lines 770 – 775:

function drupal_validate_utf8($text) {
  if (!is_string($text) || strlen($text) == 0) {
    return TRUE;
  }
  return (preg_match('/^./us', $text) == 1);
}

Comments (7)

this seems to be the only place i’ve found any solution for the problem! thanks for that! i’ve implemented this in bootstrap.inc but now it’s causing issues with block settings. did you find any better ways to fix it?

Hi Bruzed

We’ve been able to get rid of the error by applying the above code. If this should return new errors, we haven’t yet seen them.

Could you check your “reports -> recent log entries” for possible clues as to where the error is situated?

Could you provide a link to your project or website so we could have a look?

Greets!

Ho guys,

Thanks a lot. Finaly I got rid of this stupid warning. Till now I dont got any side effects.

Hi Seoco,

I’m glad I can help someone to solvehide this error! I know the solution is not ideal and far from clean, but it temporarily solves the issue until a proper drupal patch or drupal update permanently fixes the error.

if(!is_string($text)){
return “”;
}

You should also log a debug_backtrace here to find the caller that mistakenly passes something that is not a string.

Thx Heine for your suggestion!

One of my tasks is to look at metadata that can be sourced from existing Drupal code or the Drupal database. This will be used to provide default values for pages which may be over-written by the user, if required. To begin at the beginning, I believe that we need to find a value for DC.identifier, as the URI is the most fundamental piece of data that we have about a page. (Without a URI, there is no way to get to the page in the first place.)

Write a comment