Issue Type: Patch Created: 2008-09-09T15:33:53.000+0000 Last Updated: 2011-07-05T15:54:28.000+0000 Status: Resolved Fix version(s): - 1.11.8 (07/Jul/11)
Reporter: Alex Adriaanse (alexadriaanse) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Http_Client
Related issues: Attachments: - http_client_preserve_upload_order.patch
When you add both regular POST fields and file uploads in an HTTP request, the file uploads are always be sent after the regular fields, even if they were added before them the regular fields.
For example, if you have the following code:
<pre class="highlight"> $httpClient->setParameterPost('fieldA', 'valueA'); $httpClient->setFileUpload('filename.txt', 'fieldB', 'file contents', 'text/plain'); $httpClient->setParameterPost('fieldC', 'valueC');
Zend_Http_Client will reorder them as fieldA, fieldC, and fieldB when it sends it to the web server. I'm working with using Zend_Http_Client against a web application that is sensitive about the ordering of fields, and Zend_Http_Client's current behavior breaks this application.
I am attaching a patch that fixes this problem by preserving the order in which regular and file upload fields are added to Zend_Http_Client. With this patch, the field order for the previous example would be fieldA, fieldB, and fieldC.
Posted by Alex Adriaanse (alexadriaanse) on 2009-09-01T16:39:39.000+0000
I have refactored the previously posted patch and adapted it to ZF 1.9.2. I'm attaching it to this ticket.
Posted by Adam Lundrigan (adamlundrigan) on 2011-05-26T21:07:28.000+0000
I've attached a patch which implements the same functionality with less code and provides unit tests for the implementation.
Posted by Matthew Weier O'Phinney (matthew) on 2011-07-05T15:54:15.000+0000
Reviewed and applied Adam's patch to trunk and 1.11 release branch.
Have you found an issue?
See the Overview section for more details.