This warning is shown if I save the admin form e.g. in site_map module.

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1473 of D:\InetPub\wwwroot\drupal7\includes\bootstrap.inc).

I guess something in core must be broken as it's only the admin form and it's only using system_settings_form() to save settings. There is also no check_plain() used anywhere and therefore must be something that is automatically done in background by and function.

PHP: 5.3.1, 5.2.14 both the same.

CommentFileSizeAuthor
#1 FAPI_text_format_bug2.png26.24 KBhass

Comments

hass’s picture

StatusFileSize
new26.24 KB

I've put some debugging code inline...

function check_plain($text) {
  if (is_array($text)) { var_dump($text); }
  // We do not want to use drupal_static() since PHP version will never change

This issue could be releated to #820816: #type text_format not compatible with system_settings_form($automatic_defaults = TRUE). At least the repro case can be found over there... I currently guess this is a system_settings_form($form) bug

Screenshot:

sun’s picture

yarco’s picture

Status: Closed (duplicate) » Active

I'm following the link from http://drupal.org/node/820816 to http://drupal.org/node/266246.
They said it is fixed.
But i downloaded the latest version of drupal, and after i installed the devel (7.x-1.0-beta2) module, the error appears.

* Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1500 of /Users/yarco/Sites/mine/drupal/foo/drupal/includes/bootstrap.inc).
* Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1500 of /Users/yarco/Sites/mine/drupal/foo/drupal/includes/bootstrap.inc).

Maybe it is a general problem, isnt it?

yarco’s picture

Status: Active » Closed (fixed)

I found the bug in devel module. So it should be closed.

mrP’s picture

Status: Closed (fixed) » Needs work

FYI I don't think this is totally resolved yet. I'm running drupal 7x-beta1, devel 7.x-1.0-beta2, and admin 7.x-2.0-beta2 with error still occurring.

Disabling admin OR devel seems to stop error from occurring.

marcvangend’s picture

Version: 7.0-alpha5 » 7.x-dev

Subscribe. I'm seeing the same error when saving a View. Installed modules:

$ drush sm --status=enabled
 Package           Name                                   Type    Version        
 Administration    Administration menu (admin_menu)       Module  7.x-3.x-dev    
 Chaos tool suite  Chaos tools (ctools)                   Module  7.x-1.0-alpha1 
 Core              Block (block)                          Module  7.x-dev        
 Core              Database logging (dblog)               Module  7.x-dev        
 Core              Field (field)                          Module  7.x-dev        
 Core              Field SQL storage (field_sql_storage)  Module  7.x-dev        
 Core              Field UI (field_ui)                    Module  7.x-dev        
 Core              Filter (filter)                        Module  7.x-dev        
 Core              List (list)                            Module  7.x-dev        
 Core              Menu (menu)                            Module  7.x-dev        
 Core              Node (node)                            Module  7.x-dev        
 Core              Number (number)                        Module  7.x-dev        
 Core              Options (options)                      Module  7.x-dev        
 Core              System (system)                        Module  7.x-dev        
 Core              Text (text)                            Module  7.x-dev        
 Core              Update manager (update)                Module  7.x-dev        
 Core              User (user)                            Module  7.x-dev        
 Development       Devel (devel)                          Module  7.x-1.0-beta2  
 Views             Views (views)                          Module  7.x-3.x-dev    
 Views             Views exporter (views_export)          Module  7.x-3.x-dev    
 Views             Views UI (views_ui)                    Module  7.x-3.x-dev    
 Core              Seven (seven)                          Theme   7.x-dev        
 Other             Marc van Gend (genesis_marcvangend)    Theme   7.x-1.x-dev 

All dev versions are up-to-date.

marcingy’s picture

Status: Needs work » Closed (won't fix)

Please see this is won't fix for core - http://drupal.org/node/829250

marcvangend’s picture

Marcingy: thank you, sorry i didn't find that one.

Anonymous’s picture

Version: 7.x-dev » 7.8

Same problem with 7.8. "Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()". i18n module installed.

davidwhthomas’s picture

I successfully debugged this error as follows

temporarily edit bootstrap.inc ~1559

Change check_plain to:

function check_plain($text) {
  
  // Log full array of text for debug
  if(is_array($text)){
    watchdog('debug',  print_r($text, 1).'</pre>');
  }

  return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}

Then check your watchdog log at Admin > Reports > Recent log entries

In my case I had a php.ini file that was loading pdo.so

Following an upgrade of PHP on the server (5.2 to 5.3) an error about now loading the extension twice was being passed through check_plain and throwing that error msg.

I edited the local php.ini and removed the superfluous php extension loading.

Problem solved.

P.S Once finished, remove the debug log call from check_plain.

bmateus’s picture

Issue summary: View changes

@ davidwhthomas

That's it!

I had changed bootstrap.inc to not show the error, but was a matter of masquarading the problem. When updating Drupal version, this appeared again.

The fact is that I had "extension=pdo.so" as well as "extension=pdo_sqlite.so" on my php.ini (don't really know why anymore, maybe early testing), and after updating php version, it started to trigger the error, and never understood why. Your explination makes total sense

I just had to remove the "extension=pdo_sqlite.so" from php.ini, as it was not even being used.

Thank you :)

kenorb’s picture

This is mostly caused by wrong implementation of Field API. See: Field API field_schema for text field error.