diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-01-09 23:19:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-09 23:19:32 +0300 |
commit | ed1bfed7a09da2e70645e21110bffde8f19e1ed1 (patch) | |
tree | 09a17020c10ca7983f80cc05beac53def59aff87 /tests/PHPUnit/Framework/TestCase | |
parent | 9681533aa6b0cf840f39cd24648097d15edadc16 (diff) |
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
Diffstat (limited to 'tests/PHPUnit/Framework/TestCase')
-rwxr-xr-x | tests/PHPUnit/Framework/TestCase/SystemTestCase.php | 31 |
1 files changed, 21 insertions, 10 deletions
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); + } } |