From 05ccdeb650d0a4725c2d3473b97ad2567af3eaf7 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 16 Feb 2015 13:42:52 +0000 Subject: [PATCH] Ignore messages with invalid mailboxID into smsmapper --- db/smsmapper.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/smsmapper.php b/db/smsmapper.php index 0c88963..65bd0ef 100644 --- a/db/smsmapper.php +++ b/db/smsmapper.php @@ -42,6 +42,10 @@ class SmsMapper extends Mapper { $smsList = array(); while($row = $result->fetchRow()) { + // This case may not arrive, but we test if the DB is consistent + if (!in_array($row["sms_mailbox"], SmsMapper::$mailboxNames)) { + continue; + } $mbox = SmsMapper::$mailboxNames[$row["sms_mailbox"]]; if (!isset($smsList[$mbox])) { $smsList[$mbox] = array(); @@ -61,6 +65,10 @@ class SmsMapper extends Mapper { $smsList = array(); while($row = $result->fetchRow()) { + // This case may not arrive, but we test if the DB is consistent + if (!in_array($row["sms_mailbox"], SmsMapper::$mailboxNames)) { + continue; + } $mbox = SmsMapper::$mailboxNames[$row["sms_mailbox"]]; if (!isset($smsList[$mbox])) { $smsList[$mbox] = array();