warning: preg_match() expects parameter 2 to be string, array given in [mywebsite]/includes/bootstrap.inc on line 732

jeffsensat - October 12, 2008 - 04:50

Getting this error with Drupal 6.5. Looks like LOTS of others are having “preg_match” issues, with MULTIPLE configs and modules. Different “lines” are reported (mine reports line 732) but mine is associated with the core “bootstrap.inc” file. I’ve tried enabling/disabling many of the modules others are reporting. I’ve run update.php multiple times. The error won’t go away. The website still LOADS and WORKS, but this message is highlighted in red at the top of all pages, except CiviCRM.

Running a “find differences” command indicates the bootstrap.inc file on the server and a fresh one on my local drive are identical, so I suspect it’s not corrupt. Should I perhaps still replace the existing bootstrap.inc file on the website with a clean Drupal 6.5 version of that particular file?

Help?

Having the same issue with

Turkish Delight - October 15, 2008 - 05:58

Having the same issue with the drupal 5.11 distribution. Its on line 679 for me.

Same message on my installation of 6.5

marchanda - October 15, 2008 - 19:01

Same message on my installation of 6.5. Occurs in User page after updating profile.

Same error

HFMC - October 17, 2008 - 18:56

Sorry I don't have any help for you just to add seeing the same error in the logs using 6.5 preg_match() expects parameter 2 to be string, array given in bootstrap.inc on line 732.

Must be Admin-Related

jeffsensat - October 18, 2008 - 08:04

The preg_match error is present when logged in as User 1 or Admin.
The preg_match error is absent when logged in as Anonymous or Authenticated.

Any gurus care to take a stab in light of this additional info?

Quick fix

g2010a - October 18, 2008 - 19:27

Ok, something is passing an array instead of a string to the function "check_plain" on line 696 of bootstrap.inc (drupal 6), which in turn calls the function drupal_validate_utf8 on line 732. I added the following quick fix right at the beginning of the function:
if (is_array($text)) return '';

so that now it looks like this:

function check_plain($text) {
  if (is_array($text)) return ''; // <-- Modified!
  return drupal_validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
}

Asking for Trouble?

jeffsensat - October 18, 2008 - 20:03

Thanks for the solution, g2010a. It brings up this issue: is this core-level tampering advisable? While it may fix this specific problem, is it likely to break something else?

I suspected this must have been an errant module. I have MANY installed. And, honestly, I suppose I have to be honest: I’m too damn lazy to turn them off one by one until the problem goes away. It already seems to take forever when I simply visit my modules page. I suppose I’ll need to do that little bit of troubeshooting if I’m to be a good Drupal neighbor.

But, could this alternatively actually be a core issue? The hack you propose ... is it something that perhaps SHOULD be in core but isn’t? I’d love for those scary red boxes with the error message to go away, but — not being a PHP geek — I fear risking other system instabilities with the core hack.

Thoughts?

It brings up this issue: is

WorldFallz - October 18, 2008 - 21:10

It brings up this issue: is this core-level tampering advisable?

Definitely not-- even if it doesn't break anything else, by modifying core you've essentially created a fork that you will need to maintain going forward. It's fine for a quick fix-- but definitely should be tracked down and fixed properly. I would turn off all contribs and see if it goes away-- if it does try the contribs 1 by 1 until you find the offender. If it doesn't, do the same with the optional core modules.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

Has anyone else sourced a solution without patching core?

marchanda - October 20, 2008 - 22:29

Has anyone else sourced a solution without patching core? Thanks.

Location/GMAP modules

marchanda - October 21, 2008 - 17:37

If you are having the bootstrap 732 error and are running location/GMap modules, update to the newest rc release and you will hopefully be good to go.

Nope ...

jeffsensat - October 23, 2008 - 03:57

I upgraded to the latest GMap module (rc2) and the error didn’t go away. I also turned it OFF. Error still there.

Drupal 6.6 preg_match() refers to line 737 instead of 732 now.

jeffsensat - October 23, 2008 - 06:39

Just upgraded to Drupal 6.6. The preg_match() error has changed it’s tune. Now, instead of complaining about line 732, I get this error:

warning: preg_match() expects parameter 2 to be string, array given in [mywebsite]/includes/bootstrap.inc on line 737.

Same, is there an issue

Flying Drupalist - November 4, 2008 - 22:07

Same, is there an issue about this?

Also the same

panatlantica - November 6, 2008 - 15:16

Same here also...

I have exactly the same issue

josecancel - November 8, 2008 - 02:48

It happened today when I updated CCK, OG, Cumulus, and Facebook style statuses. I hope this will help pinpoint the problem.

Found the culprit - its Facebook Status

panatlantica - November 10, 2008 - 11:23

Hi everybody,

the last comment pinpointed the culprit in this case: it seems to come from the Facebook Status module. Deinstalling it and the error is gone. I added a bug report there: http://drupal.org/node/332411

That would be great, EXCEPT ...

jeffsensat - November 13, 2008 - 10:38

I don’t have the Facebook Status module installed or activated. The search continues ...

Content copy issue

paulkidd - March 27, 2009 - 02:56

This error occurred for me to, using D5.16, when I activated the CCK "content copy" module. Error disappeared as soon as content copy was deactivated. So that's a possible cause which may help some people.

same same

sayayin - August 20, 2009 - 15:46

Hi

I have the same error with :
* Drupal 6.13,
* MySQL 5.0.81
* PHP 5.2.8

"warning: preg_match() expects parameter 2 to be string, array given in /home/website/public_html/raya/includes/bootstrap.inc on line 771."

there an issue ?

S.

Same here also...

sherie - September 22, 2009 - 08:27

ERROR:

warning: preg_match() expects parameter 2 to be string, array given in /home/bingo/public_html/includes/bootstrap.inc on line 771.

Modules installed:
- Access control
- I have CCK - but not content copy enabled (so not that one for me at least)
- Image
- Ubercart
- Views

The message only shows up on checkout page. It disappears if all mods are turned off but the second I turn any two in combination with each other it reappears (it does not seem to be limited to any one mod)... and I have a few more mods to add yet!

Anyone?

Yah... here the same

suffering drupal - September 29, 2009 - 16:16

warning: preg_match() expects parameter 2 to be string, array given in /home/website/public_html/includes/bootstrap.inc on line 771.

Drupal 6.12
PHP 5
don't know about MySQL

Trying to do multidomain and multilanguage: the supposed focus and strong point of Drupal...

We also get:
warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/website/public_html/sites/all/modules/l10n_client/l10n_client.module on line 307.

Maybe interesting to know, we DO NOT get either of the warnings on the DEFAULT LANGUAGE.
So it seems a problem of multilanguage! It has given a lot of headaches from the very start.
Also the markers assigned to specific terms seem to vary randomly between languages...

Does this give any clues?

link

Christian Zwahlen - October 2, 2009 - 22:58

Check the correct use of l() http://api.drupal.org/api/function/l/5.

Problem with Views 6.x-2.7

leevester - November 9, 2009 - 03:57

Just upgraded to Views 6.x.2-7 and this very same error now appears on a number of my pages which are built using views. My line number is reporting 777 but otherwise, exactly as you have described the problem.
Downgrading to Views 6.x.2.6 cleared my problem.

Error appeared for all users on my site.

Drupal 6.14
MySQL 5.1.33
PHP 5.2.9

I will cross post this issue on the Views project.

I'm having the same problem.

Dogtag - November 12, 2009 - 18:12

I'm having the same problem. How do you downgrade? Replace the new version on the server with the older version and then run Update.php? I guess I'd have to select something from the Versions Available drop-down, right? Any way to know which item to select?

Thanks,
~Dogtag

the same

pimsn - November 11, 2009 - 19:30

Expiriencing the same problem (only difference is the line number, which is 777 in my case)... I guess it was just after I uninstalled the IMCE-Module and the associateded IMCE_Image-Field. It first appeared on the site of a content type, which used to have a IMCE-image-field, then it also appeared on a "panel-content"-page while creating a new panel-page.

???

What to do?? Any help much appreciated!!

All modules and core at the current stable releases..

Same Issue,

SandStorm - November 16, 2009 - 12:39

... but only while logged in as admin ...

any suggestions?

Same message with Menu Items List

Tilt_11 - November 28, 2009 - 22:22

Here is the message I receive on one of my sites:
warning: preg_match() expects parameter 2 to be string, array given in /home/etc../includes/bootstrap.inc on line 777.

For me, it only happens when I want to modify menu items.

visiting admin/build/menu works fine but then, when I click one of my menus (for example: "Primary Links") to manage the menu items, the message appears and the items are not listed.

An empty table is displayed, saying "Loading data..." and it doesn't load anything.

So, i don't just have the message...I can not make any change in my menus!

I have too many modules installed to list here. Unfortunately, I can not disable them one by one right now to find which one is causing the problem. I'll do it later, but in the mean time, if any one has a solution...

Thanks,
Thierry

 
 

Drupal is a registered trademark of Dries Buytaert.