After the from Drupal 6.17 to 6.19, I was getting the following message on a multi-language installation:
warning: htmlspecialchars() expects parameter 1 to be string, array given in includes/bootstrap.inc on line 857.
This is nearly the same problem as described in post.
Also this problem, was only when I was logged in or switched to the default language. The problem appears when not logged in and the language was set to the non-default language.
Fixing the problem
Open the file includes/bootstrap.inc and search for the function check_plain.
One row of the function is changed. Here is the new function of check_plain. The bold parts are edited by me. So comment out the row with //Org, and add the row with //Fix
function check_plain($text) {
static $php525;
if (!isset($php525)) {
$php525 = version_compare(PHP_VERSION, '5.2.5', '>=');
}
// We duplicate the preg_match() to validate strings as UTF-8 from
// drupal_validate_utf8() here. This avoids the overhead of an additional
// function call, since check_plain() may be called hundreds of times during
// a request. For PHP 5.2.5+, this check for valid UTF-8 should be handled
// internally by PHP in htmlspecialchars().
// @see http://www.php.net/releases/5_2_5.php
// @todo remove this when support for either IE6 or PHP < 5.2.5 is dropped.
if ($php525) {
//Org: return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
//Fix: return (preg_match('/^./us', (string) $text) == 1) ? htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8') : '';
}
return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : '';
}
Remark: This is a temperary solution to keep your site running, it is not the definitive solution. The problem will be reported and than the quick fix has to be removed.