diff --git a/src/Configuration.php b/src/Configuration.php index 1033fd0..bd25f82 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -20,7 +20,10 @@ class Configuration protected $http_authentication = 'digest'; /** @var \PHRETS\Strategies\Strategy */ protected $strategy; - protected $options = []; + protected $options = [ + 'suppress_tmp_warn' => true, + 'tmp_path' => '/tmp' + ]; public function __construct() { diff --git a/src/Session.php b/src/Session.php index c89ad46..c1550da 100644 --- a/src/Session.php +++ b/src/Session.php @@ -534,6 +534,12 @@ protected function grab($component) */ public function getDefaultOptions() { + if ($this->configuration->readOption('suppress_tmp_warn')) { + $curl = @tempnam($this->configuration->readOption('tmp_path'), 'phrets'); + } else { + $curl = tempnam($this->configuration->readOption('tmp_path'), 'phrets'); + } + $defaults = [ 'auth' => [ $this->configuration->getUsername(), @@ -546,7 +552,7 @@ public function getDefaultOptions() 'Accept-Encoding' => 'gzip', 'Accept' => '*/*', ], - 'curl' => [ CURLOPT_COOKIEFILE => tempnam('/tmp', 'phrets') ] + 'curl' => [ CURLOPT_COOKIEFILE => $curl ] ]; // disable following 'Location' header (redirects) automatically