Bug->Req #67477 [Opn->Ver]: Multidimensional arrays and CURLFile in CURLOPT_POSTFIELDS
| From: | mike@php.net | Date: | Tue, 26 Mar 2019 16:48:42 +0000 |
| Subject: | Bug->Req #67477 [Opn->Ver]: Multidimensional arrays and CURLFile in CURLOPT_POSTFIELDS | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220201@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67477&edit=1
ID: 67477
Updated by: mike@php.net
Reported by: boris dot momcilovic at gmail dot com
Summary: Multidimensional arrays and CURLFile in
CURLOPT_POSTFIELDS
-Status: Open
+Status: Verified
-Type: Bug
+Type: Feature/Change Request
Package: cURL related
Operating System: 3.14.6-1-ARCH x86_64
PHP Version: 5.5.13
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2014-06-19 12:38:21] boris dot momcilovic at gmail dot com
Description:
------------
Trying to set multidimensional array as CURLOPT_POSTFIELDS issues a NOTICE, and I suppose that end
user should make a string out (that way it's allright).
However, I see no way to pass a multidimensional array and a file together using CURLFile - which is
encouraged as of 5.5.0 (and since '@' notation is deprecated).
Test script:
---------------
<?php
$data =
[
'checked' => ['a', 'b', 'c'],
];
$ch = curl_init();
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query ($data));
// works fine
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
// Notice: Array to string conversion in test.php on line 12
$data =
[
'checked' => ['a', 'b', 'c'],
'file' => new CURLFile ('test.php')
];
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
// Notice: Array to string conversion in test.php on line 20
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67477&edit=1