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?

Comments

Turkish Delight’s picture

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

marchanda’s picture

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

HFMC’s picture

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.

jeffsensat’s picture

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?

g2010a’s picture

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) : '';
}
jeffsensat’s picture

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?

WorldFallz’s picture

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

marchanda’s picture

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

marchanda’s picture

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.

jeffsensat’s picture

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

jeffsensat’s picture

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.

Flying Drupalist’s picture

Same, is there an issue about this?

gateone’s picture

Same here also...

josecancel’s picture

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

gateone’s picture

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

jeffsensat’s picture

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

Anonymous’s picture

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.

sayayin’s picture

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.

sherie’s picture

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?

suffering drupal’s picture

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?

I started with Drupal in 2007 and then my life got stuck...

CZ’s picture

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

mbelos’s picture

Thanks Christian, your post saved me! I had an extra array in the l() function...

leevester’s picture

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.

Dogtag’s picture

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

pimsn’s picture

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..

SandStorm’s picture

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

any suggestions?

Tilt_11’s picture

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

GreenReaper’s picture

For me, the problem was exhibited by the rootcandy theme code:
#656558: $items passed to theme('item_list',...) may contain subarrays from menu_navigation_links's $menu_tree

The backtrace was:
bootstrap.inc: drupal_validate_utf8 line 741
common.inc: check_plain line 1526
theme.inc: drupal_attributes line 1499
theme.inc: call_user_func_array line 617
template.php: theme line 135
theme.inc: call_user_func_array line 617
template.php: theme line 128
page.tpl.php: _rootcandy_admin_navigation line 52
theme.inc: include line 1020
theme.inc: theme_render_template line 686
index.php: theme line 3

It passed an array of items to the theme() function but these menu arrays can have additional arrays within them not present in the standard menu tree, for example the attributes subarray here:

Array
(
    [menu-232] => Array
        (
            [attributes] => Array
                (
                    [title] => 
                )

            [href] => <front>
            [title] => Front
        )
...
[ Later, a data attribute is added to the array, like [data] => <a href="/">Front</a> ]

I think the critical part is the function theme_item_list, which declares $items as "An array of items to be displayed in the list. If an item is a string, then it is used as is. If an item is an array, then the "data" element of the array is used as the contents of the list item. If an item is an array with a "children" element, those children are displayed in a nested list. All other elements are treated as attributes of the list item element.":
http://api.drupal.org/api/function/theme_item_list/6

It is not prepared to deal with an that contains an array that is not a "children" element. It treats it as an attribute, i.e. a string, leading to the error.

Admins are seeing it because rootcandy is normally used as an admin-only theme. It is linked to menus because the primary links may contain such [attributes] subarrays. There may well be similar assumptions made by other code.

drupdruppalpal’s picture

Hi, i have the same issue with and without rootcandy, what do you think about that solution?
http://drupal.org/node/525036

i dont like but i need to solve it.

jelutz77’s picture

I'm installing, with an empty database and a fresh download of 6.15, and I get this error after the first screen with line 777. The error shows on the "Set up Database" screen. Here is the complete error text:

====
Warning: preg_match() expects parameter 2 to be string, array given in C:\wamp\www\drupal\includes\bootstrap.inc on line 777

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\drupal\includes\bootstrap.inc:777) in C:\wamp\www\drupal\includes\common.inc on line 148
====

I'm trying to use a peculiar setup though; shared login/profiles and separate tables otherwise. This is a documented feature, as shown in the default.settings.php file:

====
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.
* The 'default' element holds the prefix for any tables not specified
* elsewhere in the array. Example:
*
* $db_prefix = array(
* 'default' => 'main_',
* 'users' => 'shared_',
* 'sessions' => 'shared_',
* 'role' => 'shared_',
* 'authmap' => 'shared_',
* );
====

After enabling this setup (taking care to put ends on the comment blocks) and disabling the later assignment of $db_prefix='', the error occurs and allows the installation to continue. After continuing, the tables are installed with no prefixes whatsoever. This is only a warning, but results in a complete nullification of the feature.

When using an alternate setup with a single value instead of an array here, the tables are prefixed correctly.

I see this issue has been around for about 2 years now. I hope it is resolved soon, as my alternative to using this is some hack or a workaround involving LDAP or something.

jelutz77’s picture

I've tested a workaround. installing as separate databases and then changing these configuration values to point to a common set of tables works for signing in, adding a user, and changing passwords at least. When browsing from one site to another though, it doesn't remember the session, and requires another login.

zenGruv’s picture

Unless we're both doing something wrong, it's still broken. Any progress on your end yet?

srobert72’s picture

Error still exists with Drupal 6.16
warning: preg_match() expects parameter 2 to be string, array given in /home/drupal/includes/bootstrap.inc on line 777.

It appears only on translated pages. It doesn't on pages in default language.

------------------------------------------------

http://www.ilemaurice-bonplan.com

srobert72’s picture

Hi all, here is a solution:

for Drupal 6.16
http://drupal.org/node/525036#comment-2144000
for Drupal 6.17
http://drupal.org/node/525036#comment-3046610

------------------------------------------------

http://www.ilemaurice-bonplan.com

pixelsweatshop’s picture

subscribing

AlfTheCat’s picture

subscribing

----
"People make mistakes. To really mess something up you need a computer."

Ivo.Radulovski’s picture

got the same error after defining a views date filter

akaserer’s picture

subscribing

generix’s picture

Following up from the error's here and http://drupal.org/node/829250#comment-3444480

I found that the error showed up when I updated the latest Feed's module. I updated Views, CCK, Panels, CTools and nothing fixed it. I physically uninstalled/removed Feed's then re-installed the module and the error went away.