I'm using PHP5 (on Windows Server 2003 using IIS 6.0) I was getting this error while viewing the tree tab on nodes. Clicking various other nodes and roles would cause multiple of these errors at the same time.
Here's the error:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\\modules\pacs\pacs.module on line 60.

I dug through the code in the module and had it print

I found out that in PHP5 the array_merge() function now only accepts of type array.

"The behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() now only accepts parameters of type array. However, you can use typecasting to merge other types." - http://us2.php.net/array_merge

So I added the (array) typecast to the second argument of the array_merge($nde,$grs) function. The line changed from:
if (isset($grs)) $nde = array_merge($nde,$grs);
to:
if (isset($grs)) $nde = array_merge($nde,(array)$grs);

Now the errors are gone. I'm not sure how this may affect the module overall and needs to be reviewed. As far as I can tell, everything is working fine after that change. I don't think it should affect anything in PHP4, but I don't have drupal setup on PHP4 currently, so I can't test it.
I attached a patch, though it's an extremely minor change.

CommentFileSizeAuthor
pacs.module.patch.txt513 bytespreventingchaos
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

peterone’s picture

Status: Needs review » Fixed

Thank you very much, gcopenhaver.

I just fixed it, but I opted to change the isset() function to empty():
if (!empty($grs)) $nde = array_merge($nde,$grs);

Anonymous’s picture

Status: Fixed » Closed (fixed)