Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup cookie jar #4303

Merged
merged 1 commit into from
Mar 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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