Bug #51634 [NEW]: Can't post multiple fields with the same name
From:
Operating system: Ubuntu
PHP version: 5.2.13
Package: cURL related
Bug Type: Bug
Bug description:Can't post multiple fields with the same name
Description:
------------
With CLI curl I can run
curl -F test=value -F test=value --trace-ascii trace
http://localhost/test.php
and in the file trace I see that it posted multipart/form-data with two
fields called "test" with content "value".
I need this same behaviour from PHP. But the only way at present, it seems,
to add form fields to the curl handle (and have them transmit as
multipart/form-data) is to use curl_setopt($ch, CURLOPT_POSTFIELDS, $data)
where $data is an array of name->value pairs.
Obviously I can't have two pairs in this array with the same name.
I've tried array("name" => array("val1", "val2")) but that
posts the string
"Array" as the value for field "name".
I've tried array("name[]" => array("val1", "val2")) but that
posts the
string "Array" as the value for field "name[]" (PHP then parses this into
an array but only "val2" is in it.)
I've tried array("name[]" => "val1", "name[]" =>
"val2") but of course that
doesn't work since as soon as that array is initialized it's only got one
element -- the second overwrote the first.
I think allowing array("name" => array("val1", "val2")) would be
the best
solution. (And brackets should not be added to the end of "name" unless
specified.)
--
Edit bug report at http://bugs.php.net/bug.php?id=51634&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51634&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51634&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51634&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51634&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51634&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51634&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51634&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51634&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51634&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51634&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51634&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51634&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51634&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51634&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51634&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51634&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51634&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51634&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51634&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51634&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51634&r=mysqlcfg
Thread (12 messages)
- bart at tremby dot net
- bart at tremby dot netBug #51634 [Opn]: Can't post multiple fields with the same name
- felipe@php.netBug #51634 [Opn]: Can't post multiple fields with the same name
- bart at tremby dot netBug #51634 [Opn]: Can't post multiple fields with the same name
- raphael dot droz+floss at gmail dot comBug #51634 [Com]: Can't post multiple fields with the same name
- mike@php.netBug #51634 [Asn->Opn]: Can't post multiple fields with the same name
- requinix@php.netBug->Req #51634 [Opn]: Can't post multiple fields with the same name
- randallfstewart at gmail dot comReq #51634 [Com]: Can't post multiple fields with the same name
- psufan513 at aol dot comReq #51634 [Com]: Can't post multiple fields with the same name
- neuner at futureweb dot atReq #51634 [Com]: Can't post multiple fields with the same name
- derick@php.netReq #51634 [Opn->Asn]: Can't post multiple fields with the same name
- derick@php.netReq #51634 [Asn->Csd]: Can't post multiple fields with the same name