Req #51634 [Com]: Can't post multiple fields with the same name

From: Date: Sun, 15 Sep 2019 22:18:31 +0000
Subject: Req #51634 [Com]: Can't post multiple fields with the same name
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222758@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51634&edit=1 ID: 51634 Comment by: randallfstewart at gmail dot com Reported by: bart at tremby dot net Summary: Can't post multiple fields with the same name Status: Open Type: Feature/Change Request Package: cURL related PHP Version: 7.1 Block user comment: N Private report: N New Comment: I wanted to add that the current approach (simple name-value POSTs stored as array element indexes and array element values) fails for HTTP Multipart/Form-Data file uploads. The RFC actually requires that multiple file uploads from the same field all use the same name. See section 4.3 of RFC 7578: "To match widely deployed implementations, multiple files MUST be sent by supplying each file in a separate part but all with the same 'name' parameter." I came across this while trying to use the mailgun API with multiple attachments. The mailgun API, in accordance with RFC 7578, requires all file uploads to use the same POST name "attachment." When using PHP cURL, this limits me to a single attachment. Previous Comments: ------------------------------------------------------------------------ [2018-04-13 08:23:06] requinix@php.net Reviving as a feature request. I agree that the implementation should not append []s automatically and instead require the developer to use the right name with the array key. That would allow support for languages like .NET which use multiple key= pairs. ------------------------------------------------------------------------ [2018-04-13 08:20:01] requinix@php.net Related To: Bug #76216 ------------------------------------------------------------------------ [2018-04-13 08:19:31] requinix@php.net Related To: Bug #67585 ------------------------------------------------------------------------ [2014-04-25 08:56:48] mike@php.net Related To: Bug #66436 ------------------------------------------------------------------------ [2012-05-14 20:21:12] raphael dot droz+floss at gmail dot com This patch may solve the issue. I can't see how may I have restricted the new code-path according to the key so I simply tested for values which are array themselves instead of doing any string lookup/substitution when keys matches "[]" or anything like that. I got some problem with the test-suite (can't export PHP_CURL_HTTP_REMOTE_SERVER) anyway I still had 40 skipped, 2 failures and 33 pass *after* the patch. If that patch is ok I may add a patch for the test-suite if needed. NB: please don't bite me, it's my first patch for PHP. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=51634 -- Edit this bug report at https://bugs.php.net/bug.php?id=51634&edit=1

« previous php.bugs (#222758) next »