Download & Extend

html_entity_decode() expects parameter 1 to be string, array given in views/includes/view.inc on line 676.

Project:Views
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I've just upgraded to Views-6.x-3.x-dev from Views-6.x-2.16
and I'm now getting this error on my site.

Looking at $arg, which is being passed to html_entity_decode on this line, I see that it has an array with the NID in it, eg:

Array
(
[0] => 14687
)

In one case I'm also seeing what looks to be partial contents of a form being held by $arg

Incidentially, I'm also getting a few of these errors:

warning: html_entity_decode() expects parameter 1 to be string, array given in /home/drupal/sites/all/modules/views/handlers/views_handler_field.inc on line 1070.

Comments

#1

Hello,

I am getting the same error when a user looks at his profile page, this does not happen with the admin account.

Did you succeed in fixing this issue?

thanks

#2

After updating to views-6.x-3.0 the message changes to:

warning: html_entity_decode() expects parameter 1 to be string, array given in /Drupal/sites/all/modules/views/includes/view.inc on line 562

this actually happens only for the accounts imported with the user_import module.

If someone has an idea??

thanks

#3

The only way I was able to fix this problem was by adding this code to views.inc:

     if( is_array($arg)) {
          $arg = $arg[0];
          if( is_array($arg)) {
            // if arg is still an array, something really weird has happened and we're going to skip it
            continue;
          }
        }

before the existing line 676
        $substitutions['!' . ($position + 1)] = strip_tags(html_entity_decode($arg));

I wasn't able to find where views is sending the array from, but it seemed important to pass the value inside of the array if it was just an NID inside the array.

#4

thank you for your answer.
I think I know why I am getting this error: I am importing accounts but only the basic information (username - name - surname) and actually in this website each profile has several mandatory fields that I am not filling during the import, and that's maybe why the error shows.
This seems to be an issue related to Drupal 6 as in Drupal 7 I could create accounts by importing the basic information and then the user would fill out the missing fields without any error message.