From: boris dot momcilovic at gmail dot com
Operating system: 3.14.6-1-ARCH x86_64
PHP version: 5.5.13
Package: cURL related
Bug Type: Bug
Bug description:Multidimensional arrays and CURLFile in CURLOPT_POSTFIELDS
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 bug report at https://bugs.php.net/bug.php?id=67477&edit=1
--