Skip to content

Commit

Permalink
Allow for empty cache when new instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Israel J. Carberry committed Aug 27, 2020
1 parent b4394e7 commit a36b96c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ET_CacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public function get()
{
$now = time();
$data = ET_CacheService::$cachedSoapUrls[$this->_identifier] ?? null;
if (!$data || !$data->expires || $data->expires < $now) {
if (is_array(ET_CacheService::$cachedSoapUrls)
&& array_key_exists($this->_identifier, ET_CacheService::$cachedSoapUrls)
&& (!$data || !$data->expires || $data->expires < $now)
) {
// remove expired data from the array
unset(ET_CacheService::$cachedSoapUrls[$this->_identifier]);
return null;
Expand Down

0 comments on commit a36b96c

Please sign in to comment.