Skip to content

Commit 0dcae09

Browse files
committed
Native unserialisation rather than relying on JSON
1 parent d9a2840 commit 0dcae09

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"require": {
66
"php": ">=7.4",
77
"ext-openssl": "*",
8-
"ext-json": "*",
98
"phpgt/http": "1.*",
109
"phpgt/session": ">=1.1"
1110
},

src/Token.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,10 @@ public function decryptResponseCipher(string $cipher):UserData {
6060
throw new ResponseCipherDecryptionException();
6161
}
6262

63-
try {
64-
$obj = json_decode(
65-
$decrypted,
66-
false,
67-
2,
68-
JSON_THROW_ON_ERROR
69-
);
70-
}
71-
catch(JsonException $exception) {
63+
$obj = unserialize(
64+
$decrypted
65+
);
66+
if($obj === false) {
7267
throw new InvalidUserDataSerializationException();
7368
}
7469

0 commit comments

Comments
 (0)