Zend_Http_Client-Migration.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.http.client.migration">
  4. <title>Migrating from previous versions</title>
  5. <para>
  6. While the external API of <classname>Zend_Http_Client</classname> has remained
  7. consistent throughout the 1.x brach of Zend Framework, some changes were introduced
  8. to the internal structure of <classname>Zend_Http_Client</classname> and its related
  9. classes.
  10. </para>
  11. <para>
  12. These changes should have no affect on code using <classname>Zend_Http_Client</classname>
  13. - but may have an effect on PHP classes overloading or extending it. If your application
  14. subclasses <classname>Zend_Http_Client</classname>, it is highly recommended to review
  15. the following changes before upgrading Zend Framework.
  16. </para>
  17. <sect2 id="zend.http.client.migration.tozf19">
  18. <title>Migrating from 1.8 or older to 1.9 or newer</title>
  19. <sect3 id="zend.http.client.migration.tozf19.fileuploadsarray">
  20. <title>Changes to internal uploaded file information storage</title>
  21. <para>
  22. In version 1.9 of Zend Framework, there has been a change in the way
  23. <classname>Zend_Http_Client</classname> internally stores information about
  24. files to be uploaded, set using the <classname>Zend_Http_Client::setFileUpload()</classname>
  25. method.
  26. </para>
  27. <para>
  28. This change was introduced in order to allow multiple files to be uploaded
  29. with the same form name, as an array of files. More information about this issue
  30. can be found in <ulink url="http://framework.zend.com/issues/browse/ZF-5744">this bug report</ulink>.
  31. </para>
  32. <example id="zend.http.client.migration.tozf19.fileuploadsarray.example">
  33. <title>Internal storage of uploaded file information</title>
  34. <programlisting language="php"><![CDATA[
  35. // Upload two files with the same form element name, as an array
  36. $client = new Zend_Http_Client();
  37. $client->setFileUpload('file1.txt', 'userfile[]', 'some raw data', 'text/plain');
  38. $client->setFileUpload('file2.txt', 'userfile[]', 'some other data', 'application/octet-stream');
  39. // In Zend Framework 1.8 or older, the value of the protected member $client->files is:
  40. // $client->files = array(
  41. // 'userfile[]' => array('file2.txt', 'application/octet-stream', 'some other data')
  42. // );
  43. // In Zend Framework 1.9 or newer, the value of $client->files is:
  44. // $client->files = array(
  45. // array(
  46. // 'formname' => 'userfile[]',
  47. // 'filename' => 'file1.txt,
  48. // 'ctype' => 'text/plain',
  49. // 'data' => 'some raw data'
  50. // ),
  51. // array(
  52. // 'formname' => 'userfile[]',
  53. // 'filename' => 'file2.txt',
  54. // 'formname' => 'application/octet-stream',
  55. // 'formname' => 'some other data'
  56. // )
  57. // );
  58. ]]></programlisting>
  59. </example>
  60. <para>
  61. As you can see this change permits the usage of the same form element name with
  62. more than one file - however, it introduces a subtle backwards-compatibility change
  63. and as such should be noted.
  64. </para>
  65. </sect3>
  66. </sect2>
  67. </sect1>