Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit d7c2eec

Browse files
committed
:octocat: OAuthStorageInterface::fromStorage(): allow any input
1 parent c24bbb1 commit d7c2eec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Storage/OAuthStorageAbstract.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use chillerlan\Settings\SettingsContainerInterface;
1717
use Psr\Log\{LoggerAwareTrait, LoggerInterface, NullLogger};
1818

19+
use function is_string;
20+
1921
abstract class OAuthStorageAbstract implements OAuthStorageInterface{
2022
use LoggerAwareTrait;
2123

@@ -50,7 +52,12 @@ public function toStorage(AccessToken $token):string{
5052
/**
5153
* @inheritDoc
5254
*/
53-
public function fromStorage(string $data):AccessToken{
55+
public function fromStorage($data):AccessToken{
56+
57+
if(!is_string($data)){
58+
throw new OAuthStorageException('invalid data');
59+
}
60+
5461
/** @noinspection PhpIncompatibleReturnTypeInspection */
5562
return (new AccessToken)->fromJSON($data);
5663
}

0 commit comments

Comments
 (0)