Skip to content

Commit c414beb

Browse files
authored
Merge pull request #342 from Geolim4/final
Fixed #330
2 parents beea48e + 54e4004 commit c414beb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/phpFastCache/Core/StandardPsr6StructureTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use phpFastCache\Cache\ExtendedCacheItemInterface;
1818
use phpFastCache\CacheManager;
19+
use phpFastCache\Exceptions\phpFastCacheCoreException;
1920
use Psr\Cache\CacheItemInterface;
2021

2122
/**
@@ -40,6 +41,7 @@ trait StandardPsr6StructureTrait
4041
* @param string $key
4142
* @return \phpFastCache\Cache\ExtendedCacheItemInterface
4243
* @throws \InvalidArgumentException
44+
* @throws phpFastCacheCoreException
4345
*/
4446
public function getItem($key)
4547
{
@@ -55,6 +57,9 @@ public function getItem($key)
5557
$driverArray = $this->driverRead($item);
5658

5759
if ($driverArray) {
60+
if(!is_array($driverArray)){
61+
throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray)));
62+
}
5863
$item->set($this->driverUnwrapData($driverArray));
5964
$item->expiresAt($this->driverUnwrapTime($driverArray));
6065
$item->setTags($this->driverUnwrapTags($driverArray));

0 commit comments

Comments
 (0)