Error retrieving mail - PHP 5.3?
| Project: | Mailhandler |
| Version: | 6.x-1.8 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
I'm using a fresh install of Drupal 6.14 and following the instructions given at http://drupal.org/node/542118 to do some testing for forum to listserv integration.
I can setup the mailbox and test it successfully but when I send mail to it and click the 'Retrieve' link on the /admin/content/mailhandler page I always get "warning: Parameter 1 to mailhandler_retrieve_message() expected to be a reference, value given in /var/www/html/includes/batch.inc on line 189."
/var/www/html is where my base Drupal install is located. This machine is running CentOS 5.3 with PHP 5.3 and I'm wondering if the PHP version has anything to do with it. I will test tomorrow on PHP 5.2 but any insights are appreciated.

#1
This is due to stricter error reporting in PHP 5.3. This was also technically incorrect in PHP 5.2 but there was no warning message. See #360605: PHP 5.3 Compatibility for discussion of workarounds in core. (EDITED to link to a more relevant issue).
#2
It looks to me like the batch API doesn't even use the first parameter at all. So we should be able to create a separate wrapper function for use by the batch API. This needs testing..
#3
The error indeed goes away with this patch. So far it seems to be working now.
#4
@mfb if you change:
<?php$operations[] = array(
'mailhandler_retrieve_message',
array($result, $mailbox, $message_number),
);
?>
to:
<?php$operations[] = array(
'mailhandler_retrieve_message',
array(NULL, $mailbox, $message_number),
);
?>
does the warning go away?
#5
No that doesn't help, because Batch API still passes a value rather than the expected reference to mailhandler_retrieve_message()