Zend_Http_Client-Migration.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 branch 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 <methodname>Zend_Http_Client::setFileUpload()</methodname>
  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',
  38. 'userfile[]',
  39. 'some raw data',
  40. 'text/plain');
  41. $client->setFileUpload('file2.txt',
  42. 'userfile[]',
  43. 'some other data',
  44. 'application/octet-stream');
  45. // In Zend Framework 1.8 or older, the value of
  46. // the protected member $client->files is:
  47. // $client->files = array(
  48. // 'userfile[]' => array('file2.txt',
  49. 'application/octet-stream',
  50. 'some other data')
  51. // );
  52. // In Zend Framework 1.9 or newer, the value of $client->files is:
  53. // $client->files = array(
  54. // array(
  55. // 'formname' => 'userfile[]',
  56. // 'filename' => 'file1.txt,
  57. // 'ctype' => 'text/plain',
  58. // 'data' => 'some raw data'
  59. // ),
  60. // array(
  61. // 'formname' => 'userfile[]',
  62. // 'filename' => 'file2.txt',
  63. // 'formname' => 'application/octet-stream',
  64. // 'formname' => 'some other data'
  65. // )
  66. // );
  67. ]]></programlisting>
  68. </example>
  69. <para>
  70. As you can see, this change permits the usage of the same form element name with
  71. more than one file - however, it introduces a subtle backwards-compatibility change
  72. and as such should be noted.
  73. </para>
  74. </sect3>
  75. <sect3 id="zend.http.client.migration.tozf19.getparamsrecursize">
  76. <title>Deprecation of Zend_Http_Client::_getParametersRecursive()</title>
  77. <para>
  78. Starting from version 1.9, the protected method <methodname>_getParametersRecursive()</methodname>
  79. is no longer used by <classname>Zend_Http_Client</classname> and is deprecated.
  80. Using it will cause an E_NOTICE message to be emitted by PHP.
  81. </para>
  82. <para>
  83. If you subclass <classname>Zend_Http_Client</classname> and call this method, you
  84. should look into using the <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
  85. static method instead.
  86. </para>
  87. <para>
  88. Again, since this <classname>_getParametersRecursive</classname> is a protected method,
  89. this change will only affect users who subclass <classname>Zend_Http_Client</classname>.
  90. </para>
  91. </sect3>
  92. </sect2>
  93. </sect1>