From e97932f2000a2c9fbd16e82421e3f20e8f694cb7 Mon Sep 17 00:00:00 2001
From: Robert Allerstorfer <roball@405360.no-reply.drupal.org>
Date: Sun, 25 Aug 2013 19:55:41 +0200
Subject: [PATCH] #2073743: Check if 'SoapClient' class exists before calling
 it

---
 vat_number.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vat_number.inc b/vat_number.inc
index 9d7bfc4..096c6c2 100644
--- a/vat_number.inc
+++ b/vat_number.inc
@@ -379,8 +379,12 @@ function _vat_number_validate_vat($vat_number, $skip_validation_on_service_failu
  * the host is not possible.
  */
 function _vat_number_connect_vies_database() {
+  if (!class_exists('SoapClient')) {
+    drupal_set_message(t('The PHP SOAP extension is not installed on this server. The VAT ID could not be validated.'), 'error');
+    return FALSE;
+  }
   try {
-    return @new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", array("exceptions" => 1));
+    return new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", array("exceptions" => 1));
   } catch (SoapFault $e) {
     // Connection to host not possible, europe.eu down?
     watchdog('vat_number', $e->faultstring, NULL, WATCHDOG_ERROR);
-- 

