Skip to content

Commit

Permalink
Merge pull request #4303 from wallabag/fix/cleanup-cookie
Browse files Browse the repository at this point in the history
Cleanup cookie jar
  • Loading branch information
Kdecherf committed Mar 29, 2020
2 parents c9b83a1 + b12e23a commit 6277578
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/Wallabag/CoreBundle/Helper/FileCookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

/**
* Overidden Cookie behavior to:
* - fix multiple concurrent writes (see https://github.com/guzzle/guzzle/pull/1884)
* - ignore error when the cookie file is malformatted (resulting in clearing it).
*/
class FileCookieJar extends BaseFileCookieJar
Expand All @@ -27,29 +26,6 @@ public function __construct(LoggerInterface $logger, $cookieFile)
$this->logger = $logger;
}

/**
* Saves the cookies to a file.
*
* @param string $filename File to save
*
* @throws \RuntimeException if the file cannot be found or created
*/
public function save($filename)
{
$json = [];
foreach ($this as $cookie) {
if ($cookie->getExpires() && !$cookie->getDiscard()) {
$json[] = $cookie->toArray();
}
}

if (false === file_put_contents($filename, json_encode($json), LOCK_EX)) {
// @codeCoverageIgnoreStart
throw new \RuntimeException("Unable to save file {$filename}");
// @codeCoverageIgnoreEnd
}
}

/**
* Load cookies from a JSON formatted file.
*
Expand Down

0 comments on commit 6277578

Please sign in to comment.