Zend_Http_Client-Migration.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 16960 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="zend.http.client.migration">
  5. <title>Migrating from previous versions</title>
  6. <para>
  7. While the external API of <classname>Zend_Http_Client</classname> has remained
  8. consistent throughout the 1.x brach of Zend Framework, some changes were introduced
  9. to the internal structure of <classname>Zend_Http_Client</classname> and its related
  10. classes.
  11. </para>
  12. <para>
  13. These changes should have no affect on code using <classname>Zend_Http_Client</classname>
  14. - but may have an effect on PHP classes overloading or extending it. If your application
  15. subclasses <classname>Zend_Http_Client</classname>, it is highly recommended to review
  16. the following changes before upgrading Zend Framework.
  17. </para>
  18. <sect2 id="zend.http.client.migration.tozf19">
  19. <title>Migrating from 1.8 or older to 1.9 or newer</title>
  20. <sect3 id="zend.http.client.migration.tozf19.fileuploadsarray">
  21. <title>Changes to internal uploaded file information storage</title>
  22. <para>
  23. In version 1.9 of Zend Framework, there has been a change in the way
  24. <classname>Zend_Http_Client</classname> internally stores information about
  25. files to be uploaded, set using the <classname>Zend_Http_Client::setFileUpload()</classname>
  26. method.
  27. </para>
  28. <para>
  29. This change was introduced in order to allow multiple files to be uploaded
  30. with the same form name, as an array of files. More information about this issue
  31. can be found in <ulink url="http://framework.zend.com/issues/browse/ZF-5744">this bug report</ulink>.
  32. </para>
  33. <example id="zend.http.client.migration.tozf19.fileuploadsarray.example">
  34. <title>Internal storage of uploaded file information</title>
  35. <programlisting language="php"><![CDATA[
  36. // Upload two files with the same form element name, as an array
  37. $client = new Zend_Http_Client();
  38. $client->setFileUpload('file1.txt', 'userfile[]', 'some raw data', 'text/plain');
  39. $client->setFileUpload('file2.txt', 'userfile[]', 'some other data', 'application/octet-stream');
  40. // In Zend Framework 1.8 or older, the value of the protected member $client->files is:
  41. // $client->files = array(
  42. // 'userfile[]' => array('file2.txt', 'application/octet-stream', 'some other data')
  43. // );
  44. // In Zend Framework 1.9 or newer, the value of $client->files is:
  45. // $client->files = array(
  46. // array(
  47. // 'formname' => 'userfile[]',
  48. // 'filename' => 'file1.txt,
  49. // 'ctype' => 'text/plain',
  50. // 'data' => 'some raw data'
  51. // ),
  52. // array(
  53. // 'formname' => 'userfile[]',
  54. // 'filename' => 'file2.txt',
  55. // 'formname' => 'application/octet-stream',
  56. // 'formname' => 'some other data'
  57. // )
  58. // );
  59. ]]></programlisting>
  60. </example>
  61. <para>
  62. As you can see this change permits the usage of the same form element name with
  63. more than one file - however, it introduces a subtle backwards-compatibility change
  64. and as such should be noted.
  65. </para>
  66. </sect3>
  67. <sect3 id="zend.http.client.migration.tozf19.getparamsrecursize">
  68. <title>Deprecation of Zend_Http_Client::_getParametersRecursive()</title>
  69. <para>
  70. Starting from version 1.9, the protected method <classname>_getParametersRecursive()</classname>
  71. is no longer used by <classname>Zend_Http_Client</classname> and is deprecated.
  72. Using it will cause an E_NOTICE message to be emitted by PHP.
  73. </para>
  74. <para>
  75. If you subclass <classname>Zend_Http_Client</classname> and call this method, you
  76. should look into using the <classname>Zend_Http_Client::_flattenParametersArray()</classname>
  77. static method instead.
  78. </para>
  79. <para>
  80. Again, since this <classname>_getParametersRecursive</classname> is a protected method,
  81. this change will only affect users who subclass <classname>Zend_Http_Client</classname>.
  82. </para>
  83. </sect3>
  84. <sect3 id="zend.http.client.migration.tozf19.getparamsrecursize">
  85. <title>
  86. Zend_Http_Client::_getParametersRecursive() sollte nicht mehr eingesetzt werden
  87. </title>
  88. <para>
  89. Beginnend mit Version 1.9, wird die geschützte Methode
  90. <classname>_getParametersRecursive()</classname> nicht mehr von
  91. <classname>Zend_Http_Client</classname> verwendet und ist abgelehnt (deprecated).
  92. Ihre Verwendung führt zu einer E_NOTICE Nachricht die von PHP kommt.
  93. </para>
  94. <para>
  95. Wenn man <classname>Zend_Http_Client</classname> erweitert und diese Methode
  96. aufrufr, sollte man sehen das man stattdessen die statische Methode
  97. <classname>Zend_Http_Client::_flattenParametersArray()</classname> verwendet.
  98. </para>
  99. <para>
  100. Nochmals, da <classname>_getParametersRecursive</classname> eine geschützte Methode
  101. ist, sind nur Benutzer betroffen die <classname>Zend_Http_Client</classname>
  102. erweitert haben.
  103. </para>
  104. </sect3>
  105. </sect2>
  106. </sect1>