List:Eventum Development« Previous MessageNext Message »
From:Harri Porten Date:December 16 2005 10:09am
Subject:[patch] Missing To header
View as plain text  
Hi!

I occasionally got some PHP warnings after we enabled the e-mail routing
interface. They were triggered by (spam) e-mails with missing To headers
that made this check

  if (preg_match("/$prefix(\d*)@$mail_domain/i", $email->toaddress,
$matches)) {

from class.support.php trigger the notice: "Undefined property:
toaddress in /var/www/eventum/include/class.support.php on line 550". I
therefore suggest to either guard the check (see attached patch) or simply
add a statement like

  if (empty($email->toaddress))
     return false;

further above.

Harri.



Index: class.support.php
===================================================================
RCS file: /home/cvs/root/eventum/include/class.support.php,v
retrieving revision 1.4
diff -u -3 -p -r1.4 class.support.php
--- class.support.php	16 Dec 2005 09:59:33 -0000	1.4
+++ class.support.php	16 Dec 2005 10:07:50 -0000
@@ -547,7 +547,8 @@ class Support
                     if (empty($mail_domain)) {
                         return false;
                     }
-                    if (preg_match("/$prefix(\d*)@$mail_domain/i", $email->toaddress, $matches)) {
+                    if (isset($email->toaddress) &&
+                        preg_match("/$prefix(\d*)@$mail_domain/i", $email->toaddress, $matches)) {
                         $return = Routing::route_emails($message);
                         if ($return == true) {
                             Support::deleteMessage($info, $mbox, $num);
Thread
[patch] Missing To headerHarri Porten16 Dec