Closed (won't fix)
Project:
Drupal core
Version:
6.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2010 at 15:42 UTC
Updated:
15 Sep 2010 at 19:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
a3dse commentedLook here: http://drupal.org/node/320145#comment-2673928
Comment #2
dungcan88 commentedI tried this method by replace:
return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
by
return htmlspecialchars((string)$text, ENT_QUOTES, 'UTF-8');
in line 840 of the file bootstrap.inc (Drupal 6.17) and the warning disappears.
However, then the number of reads for each post shows the string "Array" instead of a correct number. I attach a file to show this error here.
Please help me.
Comment #3
yakker commentedGetting the same error after upgrading to 6.17. Seems to always occur in the error log after a comment form submission is BLOCKED by Captcha. However, blocked comment submissions do not always get followed by the error. There's another thread about this being started here: http://drupal.org/node/831722, but it's about as short as this one...
Comment #4
Rosamunda commentedThis patch works, and it has been reviewed by several users (in that post that I linked)... Would it be commited?
Thanks!
Comment #5
gábor hojtsy1. There is no patch attached.
2. Changes go to Drupal 7 before Drupal 6.
3. This issue is with the calling function not with our htmlspecialchars() invocation. Even if we cast an array to string, we will get "Array" in PHP, so not much use to get the actual content of the array. The error will go away, but it will not work as it supposed to. The caller has an issue, not this function.
Comment #6
pixelsweatshop commentedsubscribing
Comment #7
sansui commentedSubscribing. Have this problem on 6.17 and haven't pinned down the cause yet
Comment #8
bacchus101 commentedsubscribing
Comment #9
mstef commented[edit out]
Turned out to be a default_value issue.
Comment #10
sansui commentedCannot find a culprit for this warning anywhere. I've disabled every module that uses htmlspecialchars and none of them seem to be causing the issue. Tried different themes, disabling all new modules. I've developed a nervous twitch every time I see it pop up now >.<
Comment #11
newToo commentedThis started happening for me after i installed the SWFupload module. I would create a node with several images, after i submit the node it's fine. But after I edit the node and change the order of the images i start getting this error.
If I delete the images the warning goes away. I'm then able to add new images in the same node and no warning. It just doesn't like to have the images rearranged.
Comment #12
gábor hojtsy@newToo: now that you know the problematic module, please submit an issue with that module. The issue should be fixed there, and they'll probably not know about it if its not in their queue.
Comment #13
sansui commentedWow, thanks newToo. swfupload seems to be my issue as well. I created a thread there - I didn't pin it as the culprit for my case since apparently if there is only one image attached to a node, the warning doesn't show up, so I assumed swfupload was not to blame. It only happens with multiple images (although it happens to me whether I re-order them or not)
Comment #14
yakker commentedI want to keep this alive for those (like me) who do not have swfupload installed - still getting the error though...
Comment #15
alfthecat commentedsubscribing
Comment #16
ikeigenwijs commentedsubscribe
Comment #17
kreaclic commentedSubscribe
Comment #18
akaserer commentedseems like its not fixed in drupal 6.19?
i updated and i still have this error message.
Comment #19
gábor hojtsy@akaserer: yes, its still an issue with one or more of your contributed modules or themes, not Drupal itself.
Comment #20
ikeigenwijs commentednow on: /bootstrap.inc on line 857.
i m also on 6.19 now, everything updated.
still the warning
Comment #21
sansui commentedYou may want to do some detective work with your installed modules. Mikesteff gave me a clue with the default_value comment, and I found that the problem I had was caused by a module in a section that referenced the #default_value of file in a foreach loop.
If you have a tool that can search for a particular string in a file (like textpad) you can search for default_value in your modules folder and help narrow down which module it could be, then start disabling until you find the culprit
Comment #22
akaserer commented@Gábor Hojtsy: ya , i guess its an issue of a contributed module.
Comment #23
nightlife2008 commentedCheck my reply @ http://drupal.org/node/525036#comment-3362618 . In my case it's a combination of Ctools and Panels.
Greets,
Kim
Comment #24
brinlo commentedI found that when I removed an Address type field (i.e. generated by the Addresses CCK module), I got these errors to go away. It seems like that module is passing around the address as a PHP array, which makes some of the form.inc and bootstrap.inc functions choke because they're expecting simple types as inputs.
Comment #25
ikeigenwijs commentedi still could not pin point the culprit, but is seems we have it on every page where there is possibility to write comments.
even on a simple node of the type page
http://www.revaki.ugent.be/?q=nl/onderwijs/onderwijs
error massages are hidden for not admin users.
but it gives an idea of the simplicity of the page
Comment #26
Anonymous (not verified) commentedGot the same problem. Does anyone have an idea on how to best debug this? I tried #21 but didn't find anything valuable or helpful. I tried disabling all modules but still had the error. This keeps on filling up my logs.
Is there a way to use Devel to get more info on this perhaps? If so, how? Thanks for any hints in advance!
Comment #27
BrittaL commentedsubscribe.
...and I can confirm, that it appears first after installing a group of other modules. Thanks to brinlo and nightlife for sharing their black sheeps causing it. And thanks to sansui advising to make a string search for default_value. I definitely will follow this and will share here, which module has caused it. We all should do it and create a list of modules causing it and should share it with the developers of that modules.
it this message occurs 8 times, does it mean that there are 8 plugins causing it?
thanks for all the good hints here!
Comment #28
sansui commenteddigidog, I was receiving the error multiple times, but the culprit for me was one module. Since there were multiple files being rendered, each instance generated another error. So unfortunately it's hard to tell if its one or multiple modules contributing to the warnings
Comment #29
BrittaL commentedSansui, many thanks for your fast reply. Did I get you right in your previous post, that you have used an advanced search-string to filter out "default_value" strings used inside of "for each()" loops? Otherwise I'll get here thousands of #default_value uses in the sites/all/modules folder ... by searching with dreamweaver ftp folder ...
Otherwise maybe this from "nightlife" (as he has posted above) could help to find the modules: http://drupal.org/node/525036#comment-3362618
but I am not really sure what I am searching for, to be honest.
And I found this part of the post from "srobert" in the other thread interesting: "... ... It appears only on translated pages. It doesn't on pages in default language." Can anybody confirm this?
Comment #30
sansui commentedMy warnings did not come on translated pages. Not sure how dreamweaver searches, but something like textpad is free and you can tell it to search all files in your local modules folder (use a asterisk to specify all file types) and then search for "default_value". You won't get thousands of values - I had 100+ modules installed and found fewer than 10 modules that I needed to check, which I then disabled/re-enabled one by one until the error went away
Comment #31
BrittaL commented@ Sansui: yeah, I know textpad. It was just a matter of low-treshold. I don't even use dreamweaver but it was just in the CS bundle and I tried searching with it before trying with others. And I had to search remote, not local. Almost every module uses #default_value, but not in a foreach loop. I also had tons modules installed. The most common ones, and mostly not the dev's or beta's, only a few which had no ready release, but needed because of dependies. My plugin manager says that panels are running in legacy mode, so I dropped it and all depending modules, also ctools. Finally the message is away and I can confirm that panel and ctools may have to do with it.
Good Night and Good Luck ...
Comment #32
BrittaL commentedits funny. re-installing them did it. now I have ctool and panels running wihtout that message ...
Comment #33
mattiasj commentedsubscribe
Comment #34
kirilius commentedI have got the same warning when trying to create a view that displays several thumbnails linked to the parent node. I get the warning after I add the image field to the view - as soon as the preview is displayed.
Comment #35
ikeigenwijs commentedThe solution i found and works what is even more enjoyable:
http://arjanwooning.nl/content/warning-htmlspecialchars-expects-paramete... its in dutch
the translation
/includes/bootstrap.inc
line nr 842 function check_plain($text) {
modify line 857
//Original return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
//fix http://arjanwooning.nl/content/warning-htmlspecialchars-expects-paramete...
return (preg_match('/^./us', (string) $text) == 1) ? htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8') : '';
i hope this helps others, took me a long time to find.
Comment #36
kirilius commentedIf that solution works, can it be rolled into the next release of Drupal core?
Comment #37
Rosamunda commentedI´m trying that out, can anyone else confirm this solution? I mean, the status of this post is "Closed "works as designed", so it will be commited? What does this status mean?
Thanks!
Rosamunda
Comment #38
kirilius commentedDoes "works as designed" mean that warning is suppossed to always show?
Comment #39
akaserer commentedi had this error message as well on my page.
after activating devel and krumo debugging i found out that the error actually comes from views.
after deleting the node-title field (with the views-field-option to show only 20 letters of the title) the error disappeared.
seems like not a core issue.
Comment #40
kirilius commentedMoving this under views issues list.
Comment #41
Rosamunda commentedI don´t quite understand it. In my case, the error appears in a node (a groupnode actually), but it has a couple of embedded views (embedded via the group .tpl). You mean that the issue should be because of anyone of that embedded views? Because the error didn´t appear in a page generated by views.
Thanks for the clarification. :)
Rosamunda
Comment #42
kirilius commentedI guess there are several use cases in which this error appears.
In my case I have a node type, which has an multi-value imagefield in it. I am trying to create a pretty standard view that displays a grid of thumbnails linked to the node (nothing fancy, just a node id argument and filter by node type). I get the error message when I try to preview the view (even before saving it).
Comment #43
alfthecat commented@kirilius true, the error appears in my admin section at times (i.g. after installing something with the Plugin_manager module) and on my module listing sometimes too.
Comment #44
kirilius commentedSomebody above suggested that the problem might be connected to SWFupload module. I have that enabled for my ImageField but I don't see how this can affect a View output. SWFupload should only take over presentation of the ImageField only in edit mode.
Comment #45
sansui commentedkirilius, the swfupload widget also processes other information like image alt, title and description. You might as well try the temp fix for swfupload that was suggested in this thread and see if it works for you - http://drupal.org/node/864208
Comment #46
Rosamunda commentedI don´t think that the problem connects necessarily with SWFupload module, because I don´t have it installed, and I´ve got the error.
Comment #47
dagmarWell, this is really hard to fix with this kind of info. I have seen this bug when I was developing some modules.
To know what was wrong I did this:
1) Install devel module:
2) Put this lines in the bootstrap.inc file:
So, this will give you the non-string that is causing problems. With this info we can trace the bug, if is a view bug...
Comment #48
kirilius commented.
Comment #49
kirilius commentedThanks dagmar. I did what you suggested and I have attached a screenshot of what I see (I get this when I try to display my view resutls). I guess I get each message twice as I have 2 results (images) in my view.
Comment #50
dawehnerAdditional try
Comment #51
kirilius commentedTried that too. The views trace information I get is this:
Comment #52
dawehnerSo this is a imagecache problem :)
Comment #53
Rosamunda commentedAgain, I don´t have image cahche and I still get this htmlspecialchars() problem...
Comment #54
dawehnerRosamunda equals Kirilius?
@rosamunda
You could try the same kind of stuff to find out the root of the problem.
Comment #55
pnigro commentedsubscribing
Comment #56
Anticosti commentedFor me the error on line 857 dissapeared after uninstalling the Case Tracker Module (casetracker-6.x-1.0-beta8)
Hope this may help...
Comment #57
kirilius commentedHmm, I don't have the Case Tracker module. It seems different people experience this problem with different module sets. Obviously it must be something either in the Drupal core or some very popular module lile Views, that everyone has.
Comment #58
merlinofchaos commentedThis is like saying "Obviously the sky is blue because blue is the favored color of the deity."
Any time invalid data is sent to check_plain(), this error occurs. That means that there could be any number of things that cause it that aren't related to each other in the slightest. Suggesting that it MUST be Views because everyone has Views is ridiculous.
YOUR problem is obviously imagecache. I say this because you provided a trace that says that imagecache calls check_plain() with invalid data. Therefore, imagecache is the next stop on your quest to find out what's wrong.
Rosamunda: As dereine said, you should do the same thing and get a trace to figure out where your version of the problem is coming from.
This entire issue got moved into the Views queue because one commenter said "My problem was with Views" (without providing any details) and suddenly everyone's problem is with Views? Please be more analytical than that.
Comment #59
Rosamunda commentedI´ve done that, and this is what I get:
Maybe in my case it has something to do with views after all?
Thanks for your help!!
Rosamunda
Update: I´ve got a group node that uses this tpl: node-consorcio.tpl.php that adds a view, and this is the line 51:
Maybe this code is what´s causing the problem?
Thanks!!
Rosamunda
Comment #60
dawehnerBetter use this code
I guess this might fix the issue
Comment #61
kirilius commentedI played with my view a bit more and found some even stanger bahaviour:
I am building a simple view that shows image (imagefield) thumbnails. If I use any Lightbox ImageCache preset for the image formatter, there is no problem. If I use any preset that I created manually, I see the error messages.
Comment #62
stompersly commentedI solved this error on my site, I am running D7 dev version from September 10th. This is a fresh install with only one node created of type blog. I disabled all the core modules except for Devel 7.x-1.0-beta2 and administraction menu and still got this error.
Then I disabled devel and the error went away.
Now I have enabled all my other modules except for Devel and still no error. Just for completeness I enabled Devel and the error came back, disabled and the error is gone. So at least on my fresh install of D7 dev the devel module is the cause.
Modules I have working include: Administration menu, Token, Pathauto, Google Analytics, Wysiwyg (with TinyMCE), Views
See also: http://drupal.org/node/910328
Comment #63
alfthecat commentedIt would be very ironic if indeed devel is the problem. Just wanted to point that out :)
Comment #64
kirilius commentedNo, I had the problem before I installed Devel ;-(
Comment #65
dawehnerYou all, this problem might be caused by different modules, for example imagecache.
Comment #66
heine commentedThis is a duplicate of #225211: warning: preg_match() expects parameter 2 to be string - SRSLY, WON'T FIX, EVER.; the error message changed for people on PHP 5.2.5+ because of some optimizations to check_plain.
This isssue itself is a trainwreck. The phrase "analytical skills of the common vole (Microtus arvalis)" comes to mind. When debugging, make yourself a cup of tea / coffee / other , then go ahead carefully. Assumptions and jumping to conclusions are your enemy.
The underlying cause is simple: check_plain() should not receive arrays as input. That's also the only thing all of you might have in common.
Patching core to remove the error message is simply masking your real issue, which is that some other module or function is passing inappropriate data to check_plain.
Please do not work around this issue by patching your core files, for reasons which are better explained elsewhere.
Instead, you should debug a little further to where the problem has originated rather than where the error message appears. You very likely have a module with a bug somewhere which passes an array to check_plain instead of a string. Each of you seeing the message might have a different module with this bug.
Because you're working on a development install (right?) and have the devel module installed, you can temporarily add a snippet of code like this to the start of check_plain() to debug the issue -
... which will show you the preceding functions and arguments which led to the passing of an array or other non-string data into check_plain().
That's where the problem lies. You may have to dig a little further (eg, "Why is it that search.module is getting handed an array of search terms when it expects a string?") but the solution is definitely not to add code to a string converting function to make it deal with non-string input.
When you identify the cause of the issue, file an issue in the appropriate module queue. Make sure to file an issue that contains sufficient information. Include the backtrace and a description of additional detective work that lead you to the conclusion the module you're filing against is indeed the culprit so the maintainer is able to fix asap. No-one is getting prizes for being vague.
For example; Should anyone of you have confirmed your root cause is an issue with views, post a new issue in the views queue, this time adding the backtrace, your additional detective work AND follow the guidelines in Obtaining support for Views issues.
If you get stuck debugging, please ask for help in the forums or on IRC.
Thanks, and good luck!
This issue has been locked.