Skip to content

Commit 8e89e31

Browse files
committed
prevent client unserialization
1 parent 18d9a05 commit 8e89e31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Client.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ public function __construct( $params ) {
6868
] );
6969
}
7070

71+
/**
72+
* Prevent unserialization
73+
*/
74+
public function __wakeup() {
75+
trigger_error( sprintf( 'Unsupported unserialization of %s', __CLASS__ ), E_USER_ERROR );
76+
}
77+
7178
/**
7279
* Returns the client
7380
*
@@ -207,7 +214,7 @@ private function _make_request( $type, $endpoint, $query = [] ) {
207214
try {
208215
$response = $this->client->request( $type, $endpoint . '.' . $this->format, $params );
209216
$this->last_response_code = $response->getStatusCode();
210-
217+
211218
return json_decode( $response->getBody()->getContents() );
212219
} catch( TransferException $e ) {
213220
echo $e->getMessage() . ' - ' . $e->getResponse()->getReasonPhrase();

0 commit comments

Comments
 (0)