Skip to content

Commit

Permalink
Fix: HTTP\Client\Curl - use array_replace instead of array_merge (num…
Browse files Browse the repository at this point in the history
…eric keys problem)
  • Loading branch information
ovr committed Feb 12, 2018
1 parent f966620 commit d001831
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Http/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class Curl extends Client
*/
protected $curlHandler;

/**
* @var array
*/
protected $parameters = array(
CURLOPT_USERAGENT => 'SocialConnect\Curl (https://github.com/socialconnect/common) v1.0',
CURLOPT_HEADER => false,
Expand All @@ -34,14 +37,14 @@ class Curl extends Client
*/
public function __construct(array $parameters = null)
{
if ($parameters) {
$this->parameters = array_merge($this->parameters, $parameters);
}

if (!extension_loaded('curl')) {
throw new RuntimeException('You need to install curl-ext to use SocialConnect-Http\Client\Curl.');
}

if ($parameters) {
$this->parameters = array_replace($this->parameters, $parameters);
}

$this->curlHandler = curl_init();
}

Expand Down

0 comments on commit d001831

Please sign in to comment.