Posted by LUTi on May 12, 2008 at 1:41pm
| Project: | Site Documentation |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | closed (fixed) |
Issue Summary
I am getting:
warning: preg_match() expects parameter 2 to be string, object given in /var/www/html/beta.gewiss.si/includes/bootstrap.inc on line 718.
Comments
#1
Oh, wonderful. I hate this error because it is a bear to track down. Can you pin it down to which section? That would be a big help.
#2
Sorry, I can't - I've tried to do something, but have to admit I'm a bit lost in the code (I am unfortunately not a Drupal developer, and also quite weak in PHP programming - as such, I am not very familiar with many things which would help here...).
What I managed to conclude is that it seems to be the object is supplied as an argument to the check_plain() function call instead of text somewhere...
Are you sure it can not happen that $blk->pages variable in line 1462 would be an object instead of a text (string)? This seems to be the most suspicious spot where things can somehow go wrong to me...
#3
Yes, that is the common cause of this error. I supplied a core patch against 5.x but it was closed as "won't fix."
I will check that code.
#4
You don't need to know code to narrow it down - just turn off all the other sections in the settings page and see if it still happens.
I have run every section on my site and don't have the problem, so it's probably some situation you have that I don't. In this case you'll have to do some of the tracking for me.
I looked at that code you mentioned. $blk->pages should be just a list of pages, so check_plain should be happy. It is on my site.
#5
The problematic section seems to be "System variables". If I deselect it, the error disappears. If I have it selected (and all other sections deselected), the error is present.
#6
I've found that a language_default variable value is stored as an object. According to the code, it is passed to the filter_xss function (line 2189 of sitedoc.module), as it is not an array...
I've created a patch attached (which includes also a solution for the issue 259215).
For the moment, this patch just prevents the error to happen, and some values of the problematic variable are displayed. Probably there are also better solutions, so any improvements are more than welcome.
#7
Thanks. I'm guessing this also the cause of the "display is broken" issue. (BTW, 259215 is fixed now).
#8
Thanks for the patch, LUTi. I decided this was one of those times that my college professor was right, "Sometimes it is better to start over than to patch what you have."
Fix committed to -dev version (will roll up at midnight GMT).
#9
Automatically closed -- issue fixed for two weeks with no activity.