From: admin at anyame dot co dot uk Operating system: fedora4 PHP version: 5.2.4 PHP Bug Type: cURL related Bug description: postfields when set through curl_setopt_array not set properly
Description: ------------ When setting a number of curl options through curl_setopt_array and using post, the postfields options are not being set properly and are reported as errored in the response. When the curl_setopt options are set seperately then the response is valid. This is for postfields only. Setting the curl options through curl_setopt_array and seperately for GET work ok php 5.2.4'./configure' \ '--with-apxs=/usr/local/apache/bin/apxs' \ '--prefix=/usr/local' \ '--with-mysql=/usr' \ '--with-mysqli' \ '--with-openssl' \ '--enable-discard-path' \ '--with-pear' \ '--enable-sockets' \ '--enable-pcntl' \ '--with-xml' \ '--enable-bcmath' \ '--enable-calendar' \ '--with-curl' \ '--with-curlwrappers' \ '--with-dom' \ '--with-dom-xslt' \ '--with-dom-exslt' \ '--enable-ftp' \ '--with-gd' \ '--with-jpeg-dir=/usr/local' \ '--with-png-dir=/usr' \ '--with-xpm-dir=/usr/X11R6' \ '--with-mcrypt' \ '--enable-track-vars' \ '--enable-mbstring' \ '--with-zlib' \ '--with-bz2' \ '--enable-inline-optimization' \ '--disable-debug' \ '--without-pic' \ ini using recommended with short-tags on. Reproduce code: --------------- Works - using yahoo webservice example. Freely available at http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html ------ <?php error_reporting(E_ALL); // The POST URL and parameters $request= 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData'; $appid = 'YahooDemo'; $query = 'http://search.yahoo.com'; $postargs = 'appid='.$appid.'&query='.urlencode($query).'&results=2'; $ch = curl_init($request); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt ($ch, CURLOPT_HEADER, true); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Output the XML echo htmlspecialchars($xml, ENT_QUOTES); ERRORS in xml ------------- <?php error_reporting(E_ALL); // The POST URL and parameters $request= 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData'; $appid = 'YahooDemo'; $query = 'http://search.yahoo.com'; $postargs = 'appid='.$appid.'&query='.urlencode($query).'&results=2'; $ch = curl_init($request); $options = array(CURLOPT_POST => true, CURLOPT_POSTFIELDS, $postargs, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true); curl_setopt_array ($ch, $options); $response = curl_exec($ch); curl_close($ch); echo htmlspecialchars($xml, ENT_QUOTES); Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:srch" xsi:schemaLocation="urn:yahoo:srch http://api.search.yahoo.com/SiteExplorerService/V1/InlinkDataResponse.xsd" totalResultsAvailable="116746" firstResultPosition="1" totalResultsReturned="2"> <Result><Title>Yahoo!</Title><Url>http://www.schakolad.com/</Url><ClickUrl>http://www.schakolad.com/</ClickUrl></Result> <Result><Title>Common Dreams | News &amp; Views</Title><Url>http://www.commondreams.org/</Url><ClickUrl>http://www.commondreams.org/</ClickUrl></Result> </ResultSet> <!-- se1.search.re4.yahoo.com uncompressed/chunked Mon Oct 1 13:39:48 PDT 2007 --> <!-- ws05.search.re2.yahoo.com uncompressed/chunked Mon Oct 1 13:39:48 PDT 2007 --> Actual result: -------------- <?xml version="1.0" encoding="UTF-8"?> <Error xmlns="urn:yahoo:api"> The following errors were detected: <Message>invalid value: appid</Message> <Message>invalid value: query</Message> </Error> <!-- ws06.search.re2.yahoo.com uncompressed/chunked Mon Oct 1 13:51:02 PDT 2007 --> -- Edit bug report at http://bugs.php.net/?id=42821&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42821&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42821&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42821&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42821&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42821&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42821&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42821&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42821&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42821&r=support Expected behavior: http://bugs.php.net/fix.php?id=42821&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42821&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42821&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42821&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42821&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42821&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42821&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42821&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42821&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42821&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42821&r=mysqlcfg