By Junro on
Hello,
I have this Warning with the page /admin/build/translate page:
warning: preg_match() expects parameter 2 to be string, array given in /home/pariscin/www/includes/bootstrap.inc on line 771
I really don't know where this warning message come from, and what it means.
Any ideas?
Thanks :)
Comments
exactly the same error
exactly the same error
Hum maybe I have
Hum maybe I have something.
Did you add into the header or footer of a page view a text with php and t function?
l. 734 in
l. 734 in bootstrap.inc
Adding the following right at the beginning of the function fixe the problem.
if (is_array($text)) return '';see: http://drupal.org/node/320145
But it's a core fixe and not very good. A module should be the cause.
_
It's also exposing a security risk.
_
I also came across this when listing "/admin/content/taxonomy/3" (with D6.14)
The error was
My fix was to cast the string to make sure it really is a string, a call to htmlspecialchars() had the same issue:
Any comments on this fix, is this an improvement that could be suggested for core?
Can confirm
Your fix is working and seems like a viable solution. But i'm not a guru in php
Worked for me too...
Thank you very much!
AND FOR ARRAY ARGUMENTS?
with my issue http://drupal.org/node/640380, i have the same problem, at this function i passed an array of id, using views argument taxonomy.
is it correct to add this code?
is the rigth thing add this code to drupal core ?
thanks
Seems right, you are checking
Seems right, you are checking the type and acting accordingly.
Worked for me
Encountered the same issue after trying to add items to a custom built menu (in the context of adding new icons to the top bar in rootcandy theme). boran's fix worked for me. Good job and thank you.
Thank you Boran
I can confirm your patch solves my problem.
It doesn't repair module that really causes this issue.
But it works.
------------------------------------------------
http://www.ilemaurice-bonplan.com
Great with fpss module
Thanks boran for this solution
Good Job Boran
Thanks Boran,
I had the same issue this morning with 6.16, I've applied these two changes to the bootstrap file and it seems to be listing terms without error.
Arthur
Today Drupal 6.17 is
Today Drupal 6.17 is released.
Patch needs to be updated :
includes/bootstrap.inc line 842
And it's work. Thank you again @boran.
------------------------------------------------
http://www.ilemaurice-bonplan.com
Yes, it works! (for me with
Yes, it works! (for me with fusioncharts sub-module of Charts)
But is this the way, or should individual modules that cause these errors be changed INSTEAD?
And if this is the way, where is the official bug report and the official patch to implement this in the next core release?
The patch works although i
The patch works although i had to change line 840 inbetween
@torstenzenk, I can confirm
@torstenzenk,
I can confirm your way worked for me too. But (@anyone) is this the right procedure to fix the problem?
thanks
subscribing
subscribing
Definitely not
This will make the error go away, but it is incorrect logically. See http://drupal.org/node/829250#comment-3148784 for details.
Also working for me.
Also working for me.
======
There are 10 people who can count binary
They who can and they who don't
Patch or Hack?
Comment 3110966 works for me. But it´s a patch or a hack?
I´ve checked all my modules, updated them and the error persists. So I´ve tried the patch and it works.
Is it safe? Is it a patch? Will it be commited? As I´m not a developer, I don´t feel good about patching/hacking core...
Thanks for the patch!
subscribing
subscribing
Subscribing
Fixed warning: htmlspecialchars() expects parameter 1 to be string, array given in /srv/www/htdocs/includes/bootstrap.inc on line 840. in Workflow for me.
subscribing
subscribing for this issu and thx again 2 Boran!
+1
Modifying lines 840 + 842 fixed my problem
This change did NOT work for
Ever since applying this patch, I now get:
Invalid argument supplied for foreach() in /var/www/html/includes/theme.inc on line 1200.
And, where Books are supposed to be, there's what looks like a button that says "Array", but it is not a button that can be pressed.
Works for me too. Thanks!
Works for me too. Thanks!
Yay, Boran!
I started getting this error immediately after upgrading to Drupal 6.15.
Modifying bootstrap.inc worked for me! Thanks, Boran!
- ataxia
Subscribing
Subscribing
------------------------------------------------
http://www.ilemaurice-bonplan.com
Thanks, Boran. I spent about
Thanks, Boran. I spent about an hour trying to figure out what was causing this precisely. Your fixed worked like a charm!
Waou, just figure out what
Waou, just figure out what module is responsable for my "warning: preg_match.... bootstrap.inc on line 771 with /admin/build/translate page"
Amazon Store module is responsable in my cause :)
I create an Amazon Store issue: #740796: warning: bootstrap.inc on line 777 with Amazon Store module enable
I have this error after
I have this error after installing Content Profile module, adding a new group (CCK) to the "profile" content type and go to the edit page of the group.
Finally, I discovered that my
Finally, I discovered that my problem was in Conditional Fields module. Upgrading the CF module to 6.x-1.1 solved it.
Updating CF 1.1 did not fix it for me- "fix" did.
I had an older version of Conditional Fields, Not enabled. But thought I'd enable and update it.
This didn't work for me. bummer.
changing
return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : '';
to
return (preg_match('/^./us', $text) == 1) ? htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8') : '';
did.
bredi
There's still a problem
I'm using RHEL5, which ships with PHP 5.1.6 In bootstrap.inc I see:
function check_plain($text) {
static $php525;
if (!isset($php525)) {
$php525 = version_compare(PHP_VERSION, '5.2.5', '>=');
}
// We duplicate the preg_match() to validate strings as UTF-8 from
// drupal_validate_utf8() here. This avoids the overhead of an additional
// function call, since check_plain() may be called hundreds of times during
// a request. For PHP 5.2.5+, this check for valid UTF-8 should be handled
// internally by PHP in htmlspecialchars().
// @see http://www.php.net/releases/5_2_5.php
// @todo remove this when support for either IE6 or PHP < 5.2.5 is dropped.
if ($php525) {
return htmlspecialchars((string)$text, ENT_QUOTES, 'UTF-8');
}
return (preg_match('/^./us', (string) $text) == 1) ? htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8') : '';
Since it appears to be checking for PHP 5.2, is it barfing on 5.1? With the fix as applied above, my site is horribly broken... images do not show up, all sorts of things are missing or broken. If I remove the "(string)" from those two lines, the site works again, but I'm again flooded with preg_match errors.
subscribing
subscribing
Still really hoping someone
Still really hoping someone can provide an answer!
Panels module
Hi guys, I did a backtrace using debug_print_backtrace() and the originating function sending an array to the check_plain function is "content_content_field_content_type_content_types()" which does a "t()" providing the Array on which the "htmlspecialchars()" function fails.
The involved modules (in my case) are a combination of Ctools and Panels.
Below I will include the first 6 entries of the backtrace log for anyone who wants it :) I have removed any long strings for easier readability.
#0 check_plain(Array ([nl] => Array (...$data...))) called at [/var/vhosts/website/includes/common.inc:932]
#1 t(Field: @widget_label (@field_name) - @field_type, Array ([@widget_label] => Visibility,[@field_name] => field_ma_visibility,[@field_type] => Array ([nl] => Array ()))) called at [/var/vhosts/website/sites/all/modules/cck/includes/panels/content_types/content_field.inc:40]
#2 content_content_field_content_type_content_types(Array ()) called at [/var/vhosts/website/sites/all/modules/ctools/includes/content.inc:149]
#3 ctools_content_get_subtypes(Array ()) called at [/var/vhosts/website/sites/all/modules/ctools/includes/content.inc:630]
#4 ctools_content_get_available_types(Array (), , Array (), Array ([other] => 1)) called at [/var/vhosts/website/sites/all/modules/panels/includes/common.inc:356]
#5 panels_common_get_allowed_types(panels_page, Array ()) called at [/var/vhosts/website/sites/all/modules/panels/panels.module:1414]
For anyone who also wants to find out where the Array (or not-string) variable comes from on their installation do as follows:
Edit includes/bootstrap.inc around line 842 and add the fragment between "static $php525" and "if (isset($php525)) {" as follows:
Have fun debugging.
/Kim
subscribing
subscribing