diff --git a/core/modules/statistics/src/StatisticsViewsResult.php b/core/modules/statistics/src/StatisticsViewsResult.php
index ef0db97..3b92470 100644
--- a/core/modules/statistics/src/StatisticsViewsResult.php
+++ b/core/modules/statistics/src/StatisticsViewsResult.php
@@ -23,9 +23,9 @@ class StatisticsViewsResult {
   protected $timestamp;
 
   public function __construct($total_count, $day_count, $timestamp) {
-    $this->totalCount = $total_count;
-    $this->dayCount = $day_count;
-    $this->timestamp = $timestamp;
+    $this->totalCount = (int) $total_count;
+    $this->dayCount = (int) $day_count;
+    $this->timestamp = (int) $timestamp;
   }
 
   /**
diff --git a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
index 09565ae..8ac0014 100644
--- a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
+++ b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php
@@ -125,7 +125,7 @@ public function testLogging() {
     $post = ['nid' => $this->node->id()];
     $this->client->post($base_root . $stats_path, ['form_params' => $post]);
     $node_counter = statistics_get($this->node->id());
-    $this->assertIdentical($node_counter['totalcount'], '1');
+    $this->assertIdentical($node_counter['totalcount'], 1);
 
     // Try fetching statistics for an invalid node ID and verify it returns
     // FALSE.
