I'm getting a warning when incorporating one of my views, funny thing though, my other view which is almost identical doesn't throw a warning.

* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/nodehierarchy/nodehierarchy_views/nodehierarchy_views.module on line 119.
* warning: Invalid argument supplied for foreach() in /sites/all/modules/views/includes/plugins.inc on line 760.

Have you seen this before? Suggestions on how to fix would be great.

CommentFileSizeAuthor
#15 nh_argument_fix-299824-15.patch846 bytesjbylsma
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TechMosaic’s picture

Title: warning: array_merge() » warning: array_merge() argument #2 is not an array

I am seeing a similar issue.

This was on a view and node hierarchy config that was working on drupal 6.3...but when I upgraded, I see this error.

I tried upgrading and downgrading the views and node hierarchy modules, but to no avail.

Any ideas on how to clear this up?

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/mysite/public_html/sites/all/modules/nodehierarchy/nodehierarchy_views/nodehierarchy_views.module on line 119. 
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/views/plugins/views_plugin_display.inc on line 509. 
TechMosaic’s picture

Just realized this is related to this post:

http://drupal.org/node/309272

Reverting to views rc1 resolves the issue.

Sorry for proliferating

usapmaster’s picture

I am having the same problem. any solution to this? I upgrade views to rc4 but still having the same problem. It was working prior to upgrade from rc1 rc3. where can i find rc1 so i can revert back? I did not back up since my site is still not up.

warning: Invalid argument supplied for foreach() in /home/mysite/public_html/modules/views/plugins/views_plugin_display.inc on line 509.

ronan’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

keva’s picture

Version: 6.x-1.0 » 6.x-1.1

I upgraded to D6.9, and just started to use NH 6.x-1.1 and Views 6.x-2-2.
Similar error messages as the OP's are being generated:

* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/nodehierarchy/nodehierarchy_views/nodehierarchy_views.module on line 117.

* warning: Invalid argument supplied for foreach() in /sites/all/modules/views/plugins/views_plugin_display.inc on line 509.

keva’s picture

Status: Closed (fixed) » Active
beckyjohnson’s picture

Version: 6.x-1.1 » 6.x-1.2
Category: support » bug

I too am now getting this issue:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/vhosts/myurl.org/httpdocs/sites/all/modules/nodehierarchy/nodehierarchy_views/nodehierarchy_views.module on line 151.

warning: Invalid argument supplied for foreach() in /var/www/vhosts/myurl.org/httpdocs/sites/all/modules/views/plugins/views_plugin_display.inc on line 547.

I do not want to downgrade to an older version of view to fix this though. I have this version of views: 6.x-2.6

Becky

crozilla’s picture

Getting same error with Node Hierarchy 6.x-1.2

Anybody’s picture

Hello!

I had the same problem and fixed it by changing line 134 in nodehierarchy_views.module:

if ((!$first_arg || ($first_arg['field'] !== "parent" && $first_arg['field'] !== "antecedent") || $first_arg['table'] !== "nodehierarchy") and is_array($view->display['default']->display_options['arguments'])) {

Added "and is_array($view->display['default']->display_options['arguments']" and brackets at the end of the check.
This seems to be a simple, but working fix with no dangerous results.

Gabriel R.’s picture

I confirm that the solution in comment #10 works. Thanks, Anybody!

deruitern’s picture

Version: 6.x-1.2 » 6.x-1.3
Status: Active » Reviewed & tested by the community

This is still a bug in nodehierarchy 1.3. Anybodys solution from #10, still worked for me, but the line number is now 136.

pdbob’s picture

Just to confirm, the final line 136 should look like this-

if ((!$first_arg || ($first_arg['field'] !== "parent" && $first_arg['field'] !== "antecedent") || $first_arg['table'] !== "nodehierarchy") and is_array($view->display['default']->display_options['arguments'])) {

Is that right?

The error went away and everything seems to be fine

deruitern’s picture

Version: 6.x-1.3 » 6.x-1.4
Component: Code » Drupal/PHP Code

Same bug exists in nodehierarchy 1.4. I'm using the lastest version of views, currently 6.x-2.12. Same solution as #10 from above, but the line number is 135.

jbylsma’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
846 bytes

I took a look into this today. I was able to reproduce the behavior if I created a view that didn't have any arguments. Funny thing was that I could disable it if I added an argument to said view, saved it, then deleted the argument and resaved. Any which way, as opposed to the previously mentioned patches, I've added logic to populate an array for arguments if one doesn't exist. I realize that this is a pretty old issue, but could some eyeballs take a look at this before I commit it to 6.x-1.x-dev? I've made the patch based on 6.x-1.4. Thanks!