mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
use JSON wrapper for decoding error catching
This commit is contained in:
parent
0a2094f069
commit
b768a2e8cb
@ -12,7 +12,9 @@
|
||||
|
||||
namespace PrivateBin;
|
||||
|
||||
use Exception;
|
||||
use PrivateBin\Configuration;
|
||||
use PrivateBin\Json;
|
||||
|
||||
/**
|
||||
* YourlsProxy
|
||||
@ -74,7 +76,13 @@ class YourlsProxy
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode($data, true);
|
||||
try {
|
||||
$data = Json::decode($data);
|
||||
} catch (Exception $e) {
|
||||
$this->_error = $e->getMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!is_null($data) &&
|
||||
array_key_exists('statusCode', $data) &&
|
||||
|
Loading…
Reference in New Issue
Block a user