Hello,
I am receiving this error 11 times on every page on my website:

Notice: Array to string conversion in views_arg_load() (line 472 of /home3/stratus4/public_html/drupal2/sites/all/modules/views/views.module).

I was using Views version 3.7 and updated to the current dev version. Also updated all my modules and to Drupal 7.25 with no change.

Does anyone have idea what is causing this error? I am not aware of anything I changed that caused it to appear.

Thank you,
Lauren

Comments

bakedbeanjk’s picture

I also get a similar message, this error msg appeared just after I upgraded the core application to 7.26

Notice: Array to string conversion in views_arg_load() (line 475 of /home3/[deleted by me]/public_html/sites/all/modules/views/views.module). I've searched on this site but cannot seem to find anything that would help, unless of course I'm searching properly

I'm not a PHP developer so is there anyone who can help?

Thanks

bakedbeanjk’s picture

I found the views.module and extracted the line of code but do not really understand, anyone who can? I appreciate that the message refers to views argument but I haven't amended any views recently and before the upgrade there wasn't a problem ie no error msgs

function views_arg_load($value, $name, $display_id, $index) {
static $views = array();

// Make sure we haven't already loaded this views argument for a similar menu
// item elsewhere.
$key = $name . ':' . $display_id . ':' . $value . ':' . $index;
if (isset($views[$key])) {
return $views[$key];
}

wgsimon’s picture

It appears that views_arg_load is being passed an array when it's expecting a string. As a stop-gap you can stick an @ in front of line 472 to hide the error message but this doesn't solve the underlying problem:

@$key = $name . ':' . $display_id . ':' . $value . ':' . $index;

wgsimon’s picture

bakedbeanjk’s picture

Hi wgsimon
Apologies if I don't fully understand #4, I am not sure what to do with the information on that page except to follow the post for further information - it does go to some extent explains what might be happening. Thanks for replying anyway. I might use #3 as a temporary measure. I sent a technical help desk ticket to my web hosting service provider in case the error messages were to do with PHP5.4. His reply was

##############

According to php.net the message that's being displayed is only an E_NOTICE type error which means it isn't causing any problems and nothing is malfunctioning. For more details on what it means and why PHP 5.4 is resulting in those warning please see this PHP.net page: http://www.php.net/manual/en/migration54.incompatible.php

##############

So it's an annoying error msg but not critical

cheers

wgsimon’s picture

Comment #4 just means that someone else had this problem before, though they didn't solve it. The suggestion in comment #3 is in line with the advice given by your service provider as the @ is just hiding the error message.

bakedbeanjk’s picture

Ok, thanks for your advice to simply hide the annoying error messages

bakedbeanjk’s picture

There is one question, even though I will add the @ (#3) should I delete the @ at some point eg when the error messages is resolved in the future or is it OK to just leave the @ in place permanently, I guess not?

wgsimon’s picture

I would only leave the @ there as an emergency measure and suggest removing it as soon as you can.

darrellduane’s picture

The problem is that $display_id is being set as an array. I saw this in my installation:

Array(
  [0] => 'page_1'
  [1] => 'page_1'
)

I added:

if(is_array($display_id) ) {
    $display_id = $display_id[0];
  }

at the beginning of

function views_arg_load($value, $name, $display_id, $index) {

and this fixed the issue, although there is still some underlying concern as to why views_arg_load() is receiving an array as the $display_id, not sure if this is supposed to happen or not.

bakedbeanjk’s picture

Thanks, I will have a go

jeff h’s picture

I had this error too; it was caused by having two views with the same URL path.

In my case, I had defined a view which hijacked /taxonomy/term/% but I also had the default view "Taxonomy term" turned on. The latter also responds at /taxonomy/term/%. As soon as I turned the built-in view off, the errors went away.

green monkey’s picture

? ... could Views Support - please offer comment on this issue and suggestions

green monkey’s picture

#12 from above where the work around is to turn off

the Views version of /taxonomy/term/% .... this works

but what I want to use the Views version and turn off the Core version - how is this done?

dqd’s picture

Status: Active » Closed (duplicate)
Related issues: +#1924892: Array to string conversion in views_arg_load

#13

"views Support"

??

Dear @tweaker, I hope you don't get me wrong, but I think there is a misunderstanding with your usage of the Drupal software and the modules: there is no views "Support", tweaker, unless you have another paid service at your hand, from which I don't know. This is a free community driven module. The support on it is you and me and the others here in the issue queues.

This issue has been marked as duplicate of #1924892: Array to string conversion in views_arg_load and will be closed.

but what I want to use the Views version and turn off the Core version - how is this done?

@tweaker. You can simply disable the regarding views view in your admin/structure/views overview, if you want, and then clear the cache. Drupal should fall back to its default term view then for you, if it is that what you have asked for.