Hi,

I am getting the following error:

array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in /home/afana/public_html/drupal5/modules/mimemail/mimemail.inc on line 106.

and this apparently related error:

array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in /home/afana/public_html/drupal5/includes/common.inc on line 1955.

which references these lines in common.inc:

    $defaults['From'] = $defaults['Reply-To'] = $from;
  }
  $headers = array_merge($defaults, $headers);   <===== line 1955
  // Custom hook traversal to allow pass by reference

It seems that PHP is having issues with the $header variable.
These errors seem to have cropped up since my host server was upgraded to PHP 5.2.6 but that may or may not be related.

Comments

sutharsan’s picture

Status: Active » Postponed (maintainer needs more info)

Which module is sending an email that causes this error?
Can you find out what the content of the Argument #2 is? The one reported in modules/mimemail/mimemail.inc on line 106. (use var_dump() to print the variable).

rkdesantos’s picture

The most recent incidences of the error were triggered by the Paypal module (submodule of eCommerce) when it triggers an IPN transaction (IPN is a Paypal feature). There are no errors on the PayPal end though the e-mail that results is not properly mime encoded and the following content is inserted in the body without the proper header content lines being set:

This is a multi-part message in MIME format.

--ae4fc17f36426e885b07cdeb69503ada
Content-Type: multipart/alternative;
    boundary="e0947c2e6ee1ae0d7a48a9c9b3f4ff73"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

IF (big if) I placed the var_dumps at the right place in the mimemail module this what I got back (email addresses obscured):
array(1) { ["mail"]=> string(18) "axxxxx@xxxxx.com" } object(stdClass)#110 (24) { ["uid"]=> string(4) "1278" ["name"]=> string(9) "Test User" ["pass"]=> string(32) "ae2b1fca515949e5d54fb22b8ed95575" ["mail"]=> string(18) "axxxxx@xxxx.com" ["mode"]=> string(1) "0" ["sort"]=> string(1) "0" ["threshold"]=> string(1) "0" ["theme"]=> string(0) "" ["signature"]=> string(0) "" ["created"]=> string(10) "1208038831" ["access"]=> string(10) "1208039180" ["status"]=> string(1) "1" ["timezone"]=> string(6) "-14400" ["language"]=> string(0) "" ["picture"]=> string(0) "" ["init"]=> string(18) "axxx@xxxxxxxxx.com" ["data"]=> string(142) "a:5:{s:7:"display";s:1:"2";s:19:"mass_contact_optout";i:0;s:12:"current_date";s:10:"1202834503";s:10:"current_id";s:2:"11";s:7:"contact";i:1;}" ["login"]=> string(10) "1208039037" ["display"]=> string(1) "2" ["mass_contact_optout"]=> int(0) ["current_date"]=> string(10) "1202834503" ["current_id"]=> string(2) "11" ["contact"]=> int(1) ["roles"]=> array(1) { [2]=> string(18) "authenticated user" } }

I dumped these variables:

  var_dump($edit);
  var_dump($user);

May or may not help but I have also tied it to this error:
Invalid argument supplied for foreach() in /home/afana/public_html/drupal5/modules/mimemail/mimemail.inc on line 21.

rkdesantos’s picture

Status: Postponed (maintainer needs more info) » Active
sutharsan’s picture

Title: PHP error: Array.merge » faulty header definition of paypal debug email
Project: Mime Mail » e-Commerce
Version: 5.x-1.x-dev » 5.x-3.x-dev
Component: Code » paypal
Category: support » bug

It is the $headers variable in mimemail_rfc_headers() which causes the problem. It should be an array and is a string.

I have found an error in the 5.3 version of the ecommerce paypal module.
The header definition on line 419 of paypal.module is wrong:

<?php
    $headers    = "From: $from\nReply-to: $from\nX-Mailer: PHP\nReturn-path: $from\nErrors-to: $from";
?>

And should be (not tested):

<?php
    $headers    = array('From' => $from, 'Reply-to' => $from, 'X-Mailer' => 'PHP', 'Return-path' => $from, 'Errors-to' => $from);
?>

Transfering this issue to e-commerce module issue queue.

rkdesantos’s picture

I tested the above change and now I longer get any errors however I no longer get the debug e-mails at all.

rkdesantos’s picture

Any further info required on this? Status of a fix?

rkdesantos’s picture

Version: 5.x-3.5 » 5.x-3.x-dev

Is any work on going with v3.4 any longer? Will this bug be fixed?

rkdesantos’s picture

Version: 5.x-3.x-dev » 5.x-3.5

This issue is still present in v3.5.

rkdesantos’s picture

Version: 5.x-3.x-dev » 5.x-3.5

Status? Can this fix be included in v3.6?

davea’s picture

Version: 5.x-3.5 » 5.x-3.x-dev

Try the latest version of ec 5.x.3.x-dev and let me know the results.

Thanks,
DaveA

rkdesantos’s picture

Installed the 5.x.3.x-dev release and so far, so good. The errors haven't returned.

Thanks for giving this some attention.

davea’s picture

Status: Active » Closed (fixed)

reopen if you need to

Thanks,
DaveA