You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
With the code below, when sending a POST request with a file upload using Zend\Http\Client, I get a different format of the posted data. Not sure if the current result is intentional or if it's a bug.
<?php// sample controller for http://localhost/class IndexController extends AbstractActionController
{
publicfunctionindexAction()
{
if ($this->getRequest()->isPost()) {
var_dump($_POST, $_FILES);
die();
}
$sl = $this->getServiceLocator();
$client = new \Zend\Http\Client('http://localhost/');
$client->setMethod('POST');
// Uncomment the line below and you'll get a different format for the posted// data. Format would be the expected one.$client->setFileUpload('/path/to/any/upload-file.jpg', 'name-of-upload');
$client->setParameterPost([
'my-posts' => [
'string-index' => 'value',
[
'key1' => 'value 1',
'key2' => 'value 1',
],
[
'key1' => 'value 2',
'key2' => 'value 2',
],
],
]);
$response = $client->send();
echo$response->getBody();
}
}
This issue has been moved from the
zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.htmlOriginal Issue: https://api.github.com/repos/zendframework/zendframework/issues/7449
User: @dranzd
Created On: 2015-04-15T00:19:30Z
Updated At: 2015-11-06T21:20:08Z
Body
PHP version: 5.5.3-1ubuntu2.6
Zend framework version: 2.3.4
With the code below, when sending a POST request with a file upload using Zend\Http\Client, I get a different format of the posted data. Not sure if the current result is intentional or if it's a bug.
Expected POST and FILES should be:
But the actual result is:
Looking at Zend\Http\Client class's flattenParametersArray method, if the lines
are replaced with
then the result would the expected one.
Without the update, the body of the request would be:
With the update, the body of the request is:
Comment
User: @malukenho
Created On: 2015-04-16T22:01:52Z
Updated At: 2015-04-16T22:01:52Z
Body
@dranzd can you send it as a unit test please?
The text was updated successfully, but these errors were encountered: