From ed1bfed7a09da2e70645e21110bffde8f19e1ed1 Mon Sep 17 00:00:00 2001
From: Matthieu Aubry <mattab@users.noreply.github.com>
Date: Tue, 10 Jan 2017 09:19:32 +1300
Subject: [PATCH] Updating piwik/referrer-spam-blacklist (1.0.11) and
 piwik/piwik-php-tracker (1.1.0) (#11158)

* Updating piwik/referrer-spam-blacklist (1.0.11) and piwik/piwik-php-tracker (1.1.0)

* Update submodules

* Fix build

* fix random bug in build when generated pageview id is a scientific notation number/string
---
 composer.lock                                 | 20 ++++++------
 .../Framework/TestCase/SystemTestCase.php     | 31 +++++++++++++------
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/composer.lock b/composer.lock
index 7863b92632..79345f09f4 100644
--- a/composer.lock
+++ b/composer.lock
@@ -885,16 +885,16 @@
         },
         {
             "name": "piwik/piwik-php-tracker",
-            "version": "1.0.3",
+            "version": "1.1.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/piwik/piwik-php-tracker.git",
-                "reference": "eb4df1e223d4b377d06785c9b5fb3723d16d4465"
+                "reference": "41dd1c03a5c324e3791b9ca82c092337dc3a0cdf"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/piwik/piwik-php-tracker/zipball/eb4df1e223d4b377d06785c9b5fb3723d16d4465",
-                "reference": "eb4df1e223d4b377d06785c9b5fb3723d16d4465",
+                "url": "https://api.github.com/repos/piwik/piwik-php-tracker/zipball/41dd1c03a5c324e3791b9ca82c092337dc3a0cdf",
+                "reference": "41dd1c03a5c324e3791b9ca82c092337dc3a0cdf",
                 "shasum": ""
             },
             "type": "library",
@@ -921,20 +921,20 @@
                 "piwik",
                 "tracker"
             ],
-            "time": "2016-07-13 05:26:45"
+            "time": "2016-12-27 09:41:03"
         },
         {
             "name": "piwik/referrer-spam-blacklist",
-            "version": "1.0.10",
+            "version": "1.0.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/piwik/referrer-spam-blacklist.git",
-                "reference": "58ecaaf7aced82ddbcc9339e1fc9e7fe9e996eb8"
+                "reference": "bf001c4e2bba063d5f13e714047c4822a975371a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/piwik/referrer-spam-blacklist/zipball/58ecaaf7aced82ddbcc9339e1fc9e7fe9e996eb8",
-                "reference": "58ecaaf7aced82ddbcc9339e1fc9e7fe9e996eb8",
+                "url": "https://api.github.com/repos/piwik/referrer-spam-blacklist/zipball/bf001c4e2bba063d5f13e714047c4822a975371a",
+                "reference": "bf001c4e2bba063d5f13e714047c4822a975371a",
                 "shasum": ""
             },
             "type": "library",
@@ -943,7 +943,7 @@
                 "Public Domain"
             ],
             "description": "Community-contributed list of referrer spammers",
-            "time": "2016-09-28 16:10:53"
+            "time": "2017-01-03 21:55:42"
         },
         {
             "name": "piwik/searchengine-and-social-list",
diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
index a2f5f5d7b6..746f4dbf0c 100755
--- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
@@ -633,28 +633,39 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase
                 continue;
             }
 
-            $rowsSql = array();
-            $bind = array();
             foreach ($rows as $row) {
+                $rowsSql = array();
+                $bind = array();
+
                 $values = array();
                 foreach ($row as $value) {
                     if (is_null($value)) {
                         $values[] = 'NULL';
-                    } else if (is_numeric($value)) {
-                        $values[] = $value;
-                    } else if (!ctype_print($value)) {
-                        $values[] = "x'" . bin2hex($value) . "'";
                     } else {
-                        $values[] = "?";
-                        $bind[] = $value;
+                        $isNumeric = preg_match('/^[1-9][0-9]*$/', $value);
+                        if ($isNumeric) {
+                            $values[] = $value;
+                        } else if (!ctype_print($value)) {
+                            $values[] = "x'" . bin2hex($value) . "'";
+                        } else {
+                            $values[] = "?";
+                            $bind[] = $value;
+                        }
                     }
                 }
 
                 $rowsSql[] = "(" . implode(',', $values) . ")";
+
+                $sql = "INSERT INTO `$table` VALUES " . implode(',', $rowsSql);
+                try {
+                    Db::query($sql, $bind);
+                } catch( Exception $e) {
+                    throw new Exception("error while inserting $sql into $table the data. SQl data: " . var_export($sql, true) . ", Bind array: " . var_export($bind, true) . ". Erorr was -> " . $e->getMessage());
+                }
+
             }
 
-            $sql = "INSERT INTO `$table` VALUES " . implode(',', $rowsSql);
-            Db::query($sql, $bind);
+
         }
     }
 
-- 
GitLab