|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66436 CURLOPT_POSTFIELDS duplicate field names
Submitted: 2014-01-07 16:50 UTC Modified: 2014-04-25 08:56 UTC
From: julian at julianrhindconsulting dot com Assigned:
Status: Duplicate Package: cURL related
PHP Version: 5.5.7 OS: any
Private report: No CVE-ID: None
 [2014-01-07 16:50 UTC] julian at julianrhindconsulting dot com

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


this can be done using the string form passing


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


and curl_setopt would generate


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


however this does not generate the correct post data - but may be understood by the server if it happens to be running PHP



Julian Rhind

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-08 23:41 UTC] cmbecker69 at gmx dot de
duplicate of #51634
 [2014-01-09 05:58 UTC] julian at julianrhindconsulting dot com
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?


 [2014-04-25 08:56 UTC]
-Status: Open +Status: Duplicate
 [2014-04-25 08:56 UTC]
Duplicate of bug #51634
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 13:01:34 2024 UTC