Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#392 RETURNTRANSFER and CUSTOMREQUEST incompatibility

closed-invalid
libcurl (356)
5
2014-08-18
2004-02-21
Matteo Beccati
No

I'm posting this here as suggested on bugs.php.net.
This bugs shows an incompatibility between
CURLOPT_RETURNTRANSFER and
CURLOPT_CUSTOMREQUEST.
For reference: http://bugs.php.net/bug.php?id=27341

Description:
------------
Trying to help a friend which wanted to do a curl HEAD
request with PHP (just like the shell curl -I does), I
wrote down this code, without much checking:

$ch = curl_init('http://foo/bar.html');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');

var_dump(curl_exec($ch));

In fact he tried it and told me it doesn't work, while this
does:

$ch = curl_init('http://foo/bar.html');

//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');

ob_start();
curl_exec($ch);
var_dump(ob_get_clean());

I tried this both on win32 and ilnux with:
Win32: libcurl/7.10.5 OpenSSL/0.9.7b zlib/1.1.4
Linux: curl 7.10.8 (i686-pc-linux-gnu) libcurl/7.10.8
OpenSSL/0.9.7c zlib/1.2.1

Discussion

    • status: open --> closed-invalid
     
  • Logged In: YES
    user_id=1110

    I'm very sorry to have to say this, but this is not a curl
    bug. CURLOPT_RETURNTRANSFER is not an option that curl
    provides, it was made up and is used by the PHP/CURL code.
    That means this bug is most likely in the PHP code base.

    I've also added a comment in that PHP bug entry saying this.
    I feel bad bouncing you back again, but I don't know what
    else to do!

     
  • Matteo Beccati
    Matteo Beccati
    2004-02-21

    Logged In: YES
    user_id=214792

    The bug on php.net was reopened, thank you :)