From 38507482645e1f851c38acbd12472761a6cc2012 Mon Sep 17 00:00:00 2001
From: Chris Burgess <chris@giantrobot.co.nz>
Date: Sun, 7 Jul 2013 01:25:36 +1200
Subject: [PATCH] Suppress E_NOTICE errors because we can end up with corrupted
 JSON from Drupal init.

---
 CRM/Utils/System/Drupal.php  | 3 ++-
 CRM/Utils/System/Drupal6.php | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php
index b1e7e27a25..50c84f7f47 100644
--- a/CRM/Utils/System/Drupal.php
+++ b/CRM/Utils/System/Drupal.php
@@ -750,7 +750,8 @@ AND    u.status = 1
       }
     }
     require_once 'includes/bootstrap.inc';
-    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+    // @ to suppress notices eg 'DRUPALFOO already defined'.
+    @drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
     // explicitly setting error reporting, since we cannot handle drupal related notices
     error_reporting(1);
diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php
index 81d7565361..46592e36ea 100644
--- a/CRM/Utils/System/Drupal6.php
+++ b/CRM/Utils/System/Drupal6.php
@@ -672,7 +672,8 @@ SELECT name, mail
       }
     }
     require_once 'includes/bootstrap.inc';
-    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+    // @ to suppress notices eg 'DRUPALFOO already defined'.
+    @drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
     // explicitly setting error reporting, since we cannot handle drupal related notices
     error_reporting(1);
-- 
GitLab