Skip to content
This repository was archived by the owner on Aug 9, 2019. It is now read-only.

Commit 6b3205f

Browse files
committed
HttpClient: Use platform independent default cookie jar filename
1 parent 620afd6 commit 6b3205f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/HttpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ public function setEncoding($encoding)
234234
/**
235235
* Enables the use of cookies.
236236
*
237-
* @param string $jarfile The full path to the file where cookies are saved
237+
* @param string $jarfile The full path to the file where cookies are saved (optional)
238238
* @throws \InvalidArgumentException if the given parameter is invalid.
239239
* @throws \LogicException if the cookie file could not be opened.
240240
*/
241-
public function acceptCookies($jarfile = '/tmp/cookies.txt')
241+
public function acceptCookies($jarfile = null)
242242
{
243-
$jarfile = (string) $jarfile;
243+
$jarfile = $jarfile ? (string) $jarfile : sys_get_temp_dir().DIRECTORY_SEPARATOR.'cookies.txt';
244244

245245
if (!is_file($jarfile) && !touch($jarfile)) {
246246
throw new \LogicException(sprintf('Cookie file "%s" could not be opened. Make sure that the directory is writable.', $jarfile));

0 commit comments

Comments
 (0)