From e3d009d13b49f3dedcf5f8bfa91545153fbc155d Mon Sep 17 00:00:00 2001
From: mattpiwik <matthieu.aubry@gmail.com>
Date: Thu, 2 Aug 2012 11:11:37 +0000
Subject: [PATCH] When I meet Jenkins in the street, I'll invite him for drinks
 for sure

git-svn-id: http://dev.piwik.org/svn/trunk@6644 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 core/Tracker.php | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/core/Tracker.php b/core/Tracker.php
index 964e6654e0..5d6c077f37 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -128,27 +128,23 @@ class Piwik_Tracker
 
 	protected function initRequests($args)
 	{
-		$post = serialize($_POST);
-		$usingBulkTracking = strpos($post, '"requests"') || strpos($post, "'requests'"); 
-		
-		if($usingBulkTracking)
-		{
-			$this->initBulkTrackingRequests();
-		}
-		else
+		$usingBulkTracking = false;
+		$rawData = file_get_contents("php://input");
+		if (!empty($rawData))
 		{
-			$this->requests = $args ? $args : (!empty($_GET) || !empty($_POST) ? array($_GET + $_POST) : array());
+			$usingBulkTracking = strpos($rawData, '"requests"') || strpos($rawData, "'requests'"); 
+			if($usingBulkTracking)
+			{
+				return $this->initBulkTrackingRequests($rawData);
+			}
 		}
+		
+		// Not using bulk tracking
+		$this->requests = $args ? $args : (!empty($_GET) || !empty($_POST) ? array($_GET + $_POST) : array());
 	}
 
-	private function initBulkTrackingRequests()
+	private function initBulkTrackingRequests($rawData)
 	{
-		$rawData = file_get_contents("php://input");
-		if (empty($rawData))
-		{
-			return;
-		}
-
 		// POST data can be array of string URLs or array of arrays w/ visit info
 		$jsonData = Piwik_Common::json_decode($rawData, $assoc = true);
 
-- 
GitLab