From f14e06966491e447b54c3132cebaa54af6fe5508 Mon Sep 17 00:00:00 2001 From: Michael Leaney Date: Tue, 6 May 2014 11:55:14 +1000 Subject: [PATCH] Handle people passing in non-arrays as properties --- lib/Analytics/Consumer/Fornax.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Analytics/Consumer/Fornax.php b/lib/Analytics/Consumer/Fornax.php index 1aafff7..e93ea1b 100644 --- a/lib/Analytics/Consumer/Fornax.php +++ b/lib/Analytics/Consumer/Fornax.php @@ -59,6 +59,17 @@ public function track($user_id, $event, $properties, $context, $timestamp) { $event = 'MissingDomain.' . ltrim($event, '.'); } + if (!is_array($properties)) { + // if a non-array was passed, create an array out of it + if (!empty($properties)) { + $properties = array( + 'message' => $properties + ); + } else { + $properties = array(); + } + } + if (isset($this->options['defaultProperties'])) { $properties = array_merge($properties, $this->options['defaultProperties']); }