Better matching existence checking
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 22 Jul 2010 18:39:29 +0000 (12:39 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 22 Jul 2010 19:25:38 +0000 (13:25 -0600)
framework/Text_Filter/lib/Horde/Text/Filter/Emails.php

index bb98673..80c780c 100644 (file)
@@ -95,7 +95,7 @@ EOR;
             $data = "\01\01\01" . base64_encode($data) . "\01\01\01";
         }
 
-        return $matches[1] . $matches[2] . $matches[9] .
+        return $matches[1] . $matches[2] . (isset($matches[9]) ? $matches[9] : '') .
             $data .
             $matches[4] . $matches[8] . (isset($matches[14]) ? $matches[14] : '');
     }
@@ -113,9 +113,9 @@ EOR;
         $class = empty($this->_params['class'])
             ? ''
             : ' class="' . $this->_params['class'] . '"';
-        $email = ($matches[10] === '')
+        $email = (!isset($matches[10]) || $matches[10] === '')
             ? $matches[3] . $matches[5]
-            : $matches[10] . $matches[11];
+            : $matches[10] . (isset($matches[11]) ? $matches[11] : '');
 
         return '<a' . $class . ' href="mailto:' . htmlspecialchars($email) . '">' . htmlspecialchars($email) . '</a>';
     }