summaryrefslogtreecommitdiff
path: root/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
diff options
context:
space:
mode:
Diffstat (limited to 'server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php')
-rw-r--r--server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
index e4e6248..9887c1d 100644
--- a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
@@ -11,7 +11,7 @@ class FileCookieJar extends CookieJar
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
-
+
/**
* Create a new FileCookieJar object
*
@@ -55,7 +55,8 @@ class FileCookieJar extends CookieJar
}
}
- if (false === file_put_contents($filename, json_encode($json))) {
+ $jsonStr = \GuzzleHttp\json_encode($json);
+ if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
@@ -73,9 +74,11 @@ class FileCookieJar extends CookieJar
$json = file_get_contents($filename);
if (false === $json) {
throw new \RuntimeException("Unable to load file {$filename}");
+ } elseif ($json === '') {
+ return;
}
- $data = json_decode($json, true);
+ $data = \GuzzleHttp\json_decode($json, true);
if (is_array($data)) {
foreach (json_decode($json, true) as $cookie) {
$this->setCookie(new SetCookie($cookie));