Skip to content

Commit 4b5b05d

Browse files
committed
#11144 Initialize getDataCache and institutionDataCache in PKPStatisticsHelper to be empty arrays
1 parent d56610f commit 4b5b05d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

classes/statistics/PKPStatisticsHelper.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ abstract class PKPStatisticsHelper
7575
public const STATISTICS_SETTING_REGION = 'country+region';
7676
public const STATISTICS_SETTING_CITY = 'country+region+city';
7777

78-
public array $geoDataCache;
79-
public array $institutionDataCache;
78+
public array $geoDataCache = [];
79+
public array $institutionDataCache = [];
8080

8181
/**
8282
* Get the usage stats directory path.
@@ -203,7 +203,7 @@ public function getLocation(string $ip, string $hashedIp, bool $flush = false):
203203
$this->geoDataCache = [];
204204
}
205205

206-
$cachedGeoData =& $this->geoDataCache;
206+
$cachedGeoData = & $this->geoDataCache;
207207
if (array_key_exists($hashedIp, $cachedGeoData)) {
208208
return $cachedGeoData[$hashedIp];
209209
}

0 commit comments

Comments
 (0)