From:             
Operating system: N/A
PHP version:      5.3.13
Package:          cURL related
Bug Type:         Bug
Bug description:CURLOPT_RETURNTRANSFER] returns both boolean and response

Description:
------------
When calling a API and converting the response to an associative array, the
returned response can not be converted because of the extra boolean in the
response. Only viewable when exit($response)

The options of the cURL operation are set using the @curl_setopt_array($ch,
$array).

When checked for the header, it does not indicate any problem and it
outputs the correct content (with content length)

When dumped the boolean is dumped with the correct response.



Test script:
---------------
// check if curl is available
if(!function_exists('curl_init')) throw new Exception('This method requires
cURL (http://php.net/curl), it seems like the extension isn\'t
installed.');
$url =
'http://ws.audioscrobbler.com/2.0/?method=album.getbuylinks&artist=radiohead&album=in%20rainbows&country=united%20kingdom&api_key=b25b959554ed76058ac220b7b2e0a026&format=json';

// set options
//              $options[CURLOPT_URL] = (string) $url;
//              $options[CURLOPT_USERAGENT] = 'PlonkHTTP '. self::version;
//              $options[CURLOPT_FOLLOWLOCATION] = true;
//              $options[CURLOPT_RETURNTRANSFER] = true;
//              $options[CURLOPT_TIMEOUT] = 20;
//              $options[CURLOPT_HEADER] = true;
                // init
                $curl = @curl_init();
//              @curl_setopt_array($curl, $options);
                curl_setopt($curl,CURLOPT_URL, (string) $url);
                curl_setopt($curl,CURLOPT_USERAGENT,'PlonkHTTP');
                curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
                // execute
                $response = @curl_exec($curl);
                // fetch errors
                $errorNumber = @curl_errno($curl);
                $errorMessage = @curl_error($curl);
                // close
                @curl_close($curl);

Expected result:
----------------
The script will result in a decent response on a local webserver. In a
production environment, it gives the extra boolean when outputted.

Actual result:
--------------
http://ws.audioscrobbler.com/2.0/?method=album.getbuylinks&artist=radiohead&album=in%20rainbows&country=united%20kingdom&api_key=b25b959554ed76058ac220b7b2e0a026&format=json

-- 
Edit bug report at https://bugs.php.net/bug.php?id=62036&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62036&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62036&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62036&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62036&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62036&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62036&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62036&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62036&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62036&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62036&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62036&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62036&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62036&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62036&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62036&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62036&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62036&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62036&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62036&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62036&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62036&r=mysqlcfg

Reply via email to