[icinga-checkins] icinga.org: icinga-api/master: * ApplySearchType() crash fixed

git at icinga.org git at icinga.org
Wed Sep 29 14:22:31 CEST 2010


Module: icinga-api
Branch: master
Commit: 795b5120502f155a0c0a616b1901c1905a6b9e70
URL:    https://git.icinga.org/?p=icinga-api.git;a=commit;h=795b5120502f155a0c0a616b1901c1905a6b9e70

Author: mojadev <mojadev at localhost.localdomain>
Date:   Wed Sep 29 14:21:44 2010 +0200

* ApplySearchType() crash fixed

---

 objects/search/IcingaApiSearchIdo.php |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/objects/search/IcingaApiSearchIdo.php b/objects/search/IcingaApiSearchIdo.php
index 2076ad3..4a6ebc9 100644
--- a/objects/search/IcingaApiSearchIdo.php
+++ b/objects/search/IcingaApiSearchIdo.php
@@ -144,7 +144,7 @@ class IcingaApiSearchIdo
 	private function applySearchType ($fields) {
 		switch ($this->searchType) {
 			case IcingaApi::SEARCH_TYPE_COUNT:
-				$fieldsArray = explode(' ', $fields);
+				$fieldsArray = explode(' AS ', $fields);
 				$countFieldsArray = count($fieldsArray);
 				if ($countFieldsArray > 2) {
 					throw new IcingaApiSearchException('applySearchType(): invalid number of columns for use of \'count\'!');
@@ -306,7 +306,7 @@ class IcingaApiSearchIdo
 						// add default values to joins
 						$valuesLong = explode(',', $variableValues);
 						foreach ($valuesLong as $currentValueLong) {
-							$valueShort = explode(' ', trim($currentValueLong));
+							$valueShort = explode(' AS ', trim($currentValueLong));
 							list($table, $column) = explode('.', $valueShort[0]);
 							if (!in_array($table, $this->joinTables)) {
 								array_push($this->joinTables, $table);





More information about the icinga-checkins mailing list