Merge pull request #3838 from totten/master-phpunit-misc
[civicrm-core.git] / CRM / Core / BAO / Note.php
index 667a94c2f46ae7f853149370b0f5e11710d070be..2e27bdacc2598f13115041ecc3f43a4961572e7a 100644 (file)
@@ -463,8 +463,7 @@ ORDER BY  modified_date desc";
    * @return array Nested associative array beginning with direct children of given note.
    * @static
    */
-  private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(
-    ), $depth = 0) {
+  private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0) {
     if ($maxDepth && $depth > $maxDepth) {
       return false;
     }
@@ -492,7 +491,7 @@ ORDER BY  modified_date desc";
 
         // paper icon view for attachments part
         $paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
-        $tree[$note->id]['attachment'] = implode('', $paperIconAttachmentInfo);
+        $tree[$note->id]['attachment'] = $paperIconAttachmentInfo ? implode('', $paperIconAttachmentInfo) : '';
 
         if ($snippet) {
           $tree[$note->id]['note'] = nl2br($tree[$note->id]['note']);