#48083 [Opn->Csd]: curl_setopt page incorrectly describes CURLOPT_POST behavior

From: Date: Mon, 27 Apr 2009 11:41:48 +0000
Subject: #48083 [Opn->Csd]: curl_setopt page incorrectly describes CURLOPT_POST behavior
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2166@lists.php.net to get a copy of this message
ID: 48083 Updated by: dave@php.net Reported By: mrtorrent at gmail dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. I've updated the documentation to reflect this. The Content-Type is forced to multipart/form-data if an array is passed to CURLOPT_POSTFIELDS. This is due to the extension using CURLOPT_HTTPPOST (which allows the use of files) for array parameters instead of CURLOPT_POSTFIELDS or CURLOPT_COPYPOSTFIELDS. CURLOPT_HTTPPOST only really needs to be used if you're using file uploads, so it's possible the code could be changed to detect this, however it's probably easier to just pass a string to CURLOPT_POSTFIELDS if you're not doing file uploads. ie. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array)); Previous Comments: ------------------------------------------------------------------------ [2009-04-27 08:38:41] mrtorrent at gmail dot com Description: ------------ As per #37760 and #16305, the curl_setopt manual page makes no mention of the fact that passing an array to CURLOPT_POSTFIELDS results in a post of type multipart/form-data rather than application/x-www-form-urlencoded when passing an array to CUROPT_POSTFIELDS instead of a string. 37760 was closed a year and half ago as fixed, but it does not actually appear to be, and this behavior is documented only in user comments on the manual apge. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48083&edit=1

« previous php.doc.bugs (#2166) next »