v1.3.0
This commit is contained in:
parent
a97911a978
commit
916d7845be
1 changed files with 6861 additions and 6907 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace GuzzleHttp\Cookie;
|
||||
|
||||
use GuzzleHttp\Utils;
|
||||
use GuzzleHttp\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Persists non-session cookies using a JSON formatted file
|
||||
|
|
@ -64,7 +64,12 @@ class FileCookieJar extends CookieJar
|
|||
}
|
||||
}
|
||||
|
||||
$jsonStr = Utils::jsonEncode($json);
|
||||
$jsonStr = \json_encode($json);
|
||||
if (\JSON_ERROR_NONE !== \json_last_error()) {
|
||||
throw new InvalidArgumentException('json_encode error: '.\json_last_error_msg());
|
||||
}
|
||||
|
||||
/** @var non-empty-string $jsonStr */
|
||||
if (false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) {
|
||||
throw new \RuntimeException("Unable to save file {$filename}");
|
||||
}
|
||||
|
|
@ -89,7 +94,11 @@ class FileCookieJar extends CookieJar
|
|||
return;
|
||||
}
|
||||
|
||||
$data = Utils::jsonDecode($json, true);
|
||||
$data = \json_decode($json, true);
|
||||
if (\JSON_ERROR_NONE !== \json_last_error()) {
|
||||
throw new InvalidArgumentException('json_decode error: '.\json_last_error_msg());
|
||||
}
|
||||
|
||||
if (\is_array($data)) {
|
||||
foreach ($data as $cookie) {
|
||||
$this->setCookie(new SetCookie($cookie));
|
||||
|
|
|
|||
Loading…
Reference in a new issue