From 42f0c93c2aeb981c3b9ee98bb484ffefc5ac9c1d Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 07 May 2015 11:43:59 -0400
Subject: [PATCH] Fixed: FS#3888 - APS installer: String could not be parsed as XML

---
 interface/lib/classes/aps_crawler.inc.php |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/interface/lib/classes/aps_crawler.inc.php b/interface/lib/classes/aps_crawler.inc.php
index 7bb2650..58a8305 100644
--- a/interface/lib/classes/aps_crawler.inc.php
+++ b/interface/lib/classes/aps_crawler.inc.php
@@ -189,6 +189,8 @@
 			curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
 			curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
 			curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
+			curl_setopt($conn[$i], CURLOPT_SSL_VERIFYHOST, 1);
+			curl_setopt($conn[$i], CURLOPT_SSL_VERIFYPEER, false);
 
 			curl_multi_add_handle($mh, $conn[$i]);
 		}
@@ -283,6 +285,7 @@
 					$apps_count = substr_count($apps[$j], '<opensearch:totalResults>0</opensearch:totalResults>');
 					if($apps_count == 0) // obviously this vendor provides one or more apps
 						{
+						try {
 						// Rename namespaces and register them
 						$xml = str_replace("xmlns=", "ns=", $apps[$j]);
 						$sxe = new SimpleXMLElement($xml);
@@ -456,9 +459,15 @@
 
 						unset($sxe);
 						$apps_in_repo++;
+						} catch (Exception $e) {
+							// We dont want the crawler to fail on xml parse errors
+							$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_WARN);
+							//echo 'Caught exception: ',  $e->getMessage(), "\n";
+						}
 					}
 				}
 				//var_dump($apps);
+				//echo print_r($apps_to_dl).'<br>-------------------<br>';
 
 				// For memory reasons, unset the current vendor and his apps
 				unset($apps);

--
Gitblit v1.9.1