Bug #66436 [Com]: CURLOPT_POSTFIELDS duplicate field names

From: Date: Thu, 09 Jan 2014 05:58:18 +0000
Subject: Bug #66436 [Com]: CURLOPT_POSTFIELDS duplicate field names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183656@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66436&edit=1 ID: 66436 Comment by: julian at julianrhindconsulting dot com Reported by: julian at julianrhindconsulting dot com Summary: CURLOPT_POSTFIELDS duplicate field names Status: Open Type: Bug Package: cURL related Operating System: any PHP Version: 5.5.7 Block user comment: N Private report: N New Comment: Hi Christoph Thanks - I see it has been reported - nearly four years ago - the problem is that a patch has been added to that bug claiming to fix the problem - however the problem remains - presumably that's why the bug has not been fixed - it's got trapped in the system - apparently fixed - but not - is it possible that the bug could get fixed? Regards Julian Previous Comments: ------------------------------------------------------------------------ [2014-01-08 23:41:27] cmbecker69 at gmx dot de duplicate of #51634 ------------------------------------------------------------------------ [2014-01-07 16:50:44] julian at julianrhindconsulting dot com Description: ------------ Hi There appears to be a problem with the current curl implementation in regard to duplicate post fields - especially when also wanting to post files In order to call curl_setopt option CURLOPT_POSTFIELDS with the following data name=Bob name=Mary this can be done using the string form passing 'name=Bob&name=Mary' however it can't be done using the array form ['name'=>'Bob', 'name'=>'Mary'] for obvious reasons When posting files it appears to be a requirement to use the array form So what is one to do - if one wants to post duplicate field names and files? This bug/design problem appears to be long standing and is inquired widely on the internet - however no one appears to be trying to resolve it Is it possible this could be resolved? The simplest solution would appear to be to handle a field name pointing to an array as a duplicate field name - so one would specify [name=>['Bob','Mary']] and curl_setopt would generate name=Bob&name=Mary I also note that this exact problem occurs when receiving posted data via $_POST - again the same solution could be used - duplicate posted fields would return an array rather than a single value I'm also aware of a workaround - using ['name[0]'=>'Bob','name[1]'=>'Mary'] however this does not generate the correct post data - but may be understood by the server if it happens to be running PHP Regards Julian Julian Rhind Expected result: ---------------- name=Bob&name=Mary Actual result: -------------- name=Mary ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66436&edit=1

« previous php.bugs (#183656) next »