ZF-11897: Zend_Http_Client_Adapter_Curl::setCurlOption only take effect for a predefined list of options

Issue Type: Bug Created: 2011-11-17T11:52:30.000+0000 Last Updated: 2011-12-02T01:49:42.000+0000 Status: Closed Fix version(s): Reporter: jon (jskarpet) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Http_Client

  • state:need-feedback

Related issues: Attachments:


I suggest the following line of code, just before the curl_exec, in order to allow curl specific options in the adapter.

410> // send the request 411> curl_setopt_array($this->_curl, $this->_config['curloptions']); 412> $response = curl_exec($this->_curl);


Posted by Adam Lundrigan (adamlundrigan) on 2011-11-18T15:22:47.000+0000

1.9.8 is quite old. Have you tried using v1.11.11?

However, I do see your point: If you look the list of allowed CURL options in Zend_Http_Client_Adapter_Curl::__construct and compare that with the list from the" rel="nofollow">PHP manual page for curl_setopt there is quite a difference.

Posted by Adam Lundrigan (adamlundrigan) on 2011-12-02T01:49:06.000+0000

Apologies...I misread the source of Zend_Http_Client_Adapter_Curl. The adapter already passes on all CURL options set via configuration key 'curloptions' or via the setter setCurlOption just before the call to curl_exec:

<pre class="highlight">
// set additional curl options
if (isset($this->_config['curloptions'])) {
    foreach ((array)$this->_config['curloptions'] as $k => $v) {
        if (!in_array($k, $this->_invalidOverwritableCurlOptions)) {
            if (curl_setopt($this->_curl, $k, $v) == false) {
                require_once 'Zend/Http/Client/Exception.php';
                throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k));


cURL options specified in $this->_invalidOverwritableCurlOptions cannot be overridden, and are ignored in the code snipped above when encountered.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.