After an upgrade of module Internationalization (i18n), I was getting the following message on a multi-language installation (Drupal 6.16):
warning: preg_match() expects parameter 2 to be string, array given in includes/bootstrap.inc on line 777.
I did not had this problem, 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.
Searching for the problem
After switching off the module “Block translation”, the problem was gone.
The problem is that on the function check_plain (row 237) an array was passed.
For a quick fix I added a check in this check_plain routine for arrays.
includes/bootstrap.inc:
* Encode special characters in a plain-text string for display as HTML.
*
* Uses drupal_validate_utf8 to prevent cross site scripting attacks on
* Internet Explorer 6.
*/
function check_plain($text) {
if (is_array($text)) return ''; //Quick fix!!!
return drupal_validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
}
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.