migration-19.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="migration.19">
  4. <title>Zend Framework 1.9</title>
  5. <para>
  6. When upgrading from a previous release to Zend Framework 1.9 or higher you
  7. should note the following migration notes.
  8. </para>
  9. <sect2 id="migration.19.zend.file.transfer">
  10. <title>Zend_File_Transfer</title>
  11. <sect3 id="migration.19.zend.file.transfer.mimetype">
  12. <title>MimeType validation</title>
  13. <para>
  14. For security reasons we had to turn off the default fallback mechanism of the
  15. <classname>MimeType</classname>, <classname>ExcludeMimeType</classname>,
  16. <classname>IsCompressed</classname> and <classname>IsImage</classname> validators.
  17. This means, that if the <emphasis>fileInfo</emphasis> or
  18. <emphasis>magicMime</emphasis> extensions can not be found, the validation will
  19. always fail.
  20. </para>
  21. <para>
  22. If you are in need of validation by using the <acronym>HTTP</acronym> fields which
  23. are provided by the user then you can turn on this feature by using the
  24. <methodname>enableHeaderCheck()</methodname> method.
  25. </para>
  26. <note>
  27. <title>Security hint</title>
  28. <para>
  29. You should note that relying on the <acronym>HTTP</acronym> fields, which are
  30. provided by your user, is a security risk. They can easily be changed and could
  31. allow your user to provide a malcious file.
  32. </para>
  33. </note>
  34. <example id="migration.19.zend.file.transfer.example">
  35. <title>Allow the usage of the HTTP fields</title>
  36. <programlisting language="php"><![CDATA[
  37. // at initiation
  38. $valid = new Zend_File_Transfer_Adapter_Http(array('headerCheck' => true);
  39. // or afterwards
  40. $valid->enableHeaderCheck();
  41. ]]></programlisting>
  42. </example>
  43. </sect3>
  44. </sect2>
  45. <sect2 id="migration.19.zend.filter">
  46. <title>Zend_Filter</title>
  47. <para>
  48. Prior to the 1.9 release, <classname>Zend_Filter</classname> allowed
  49. the usage of the static <methodname>get()</methodname> method. As with
  50. release 1.9 this method has been renamed to
  51. <methodname>filterStatic()</methodname> to be more descriptive. The
  52. old <methodname>get()</methodname> method is marked as deprecated.
  53. </para>
  54. </sect2>
  55. <sect2 id="migration.19.zend.http.client">
  56. <title>Zend_Http_Client</title>
  57. <sect3 id="migration.19.zend.http.client.fileuploadsarray">
  58. <title>Changes to internal uploaded file information storage</title>
  59. <para>
  60. In version 1.9 of Zend Framework, there has been a change in the way
  61. <classname>Zend_Http_Client</classname> internally stores information about
  62. files to be uploaded, set using the <methodname>Zend_Http_Client::setFileUpload()</methodname>
  63. method.
  64. </para>
  65. <para>
  66. This change was introduced in order to allow multiple files to be uploaded
  67. with the same form name, as an array of files. More information about this issue
  68. can be found in <ulink url="http://framework.zend.com/issues/browse/ZF-5744">this bug report</ulink>.
  69. </para>
  70. <example id="migration.19.zend.http.client.fileuploadsarray.example">
  71. <title>Internal storage of uploaded file information</title>
  72. <programlisting language="php"><![CDATA[
  73. // Upload two files with the same form element name, as an array
  74. $client = new Zend_Http_Client();
  75. $client->setFileUpload('file1.txt',
  76. 'userfile[]',
  77. 'some raw data',
  78. 'text/plain');
  79. $client->setFileUpload('file2.txt',
  80. 'userfile[]',
  81. 'some other data',
  82. 'application/octet-stream');
  83. // In Zend Framework 1.8 or older, the value of
  84. // the protected member $client->files is:
  85. // $client->files = array(
  86. // 'userfile[]' => array('file2.txt',
  87. 'application/octet-stream',
  88. 'some other data')
  89. // );
  90. // In Zend Framework 1.9 or newer, the value of $client->files is:
  91. // $client->files = array(
  92. // array(
  93. // 'formname' => 'userfile[]',
  94. // 'filename' => 'file1.txt,
  95. // 'ctype' => 'text/plain',
  96. // 'data' => 'some raw data'
  97. // ),
  98. // array(
  99. // 'formname' => 'userfile[]',
  100. // 'filename' => 'file2.txt',
  101. // 'formname' => 'application/octet-stream',
  102. // 'formname' => 'some other data'
  103. // )
  104. // );
  105. ]]></programlisting>
  106. </example>
  107. <para>
  108. As you can see, this change permits the usage of the same form element name with
  109. more than one file - however, it introduces a subtle backwards-compatibility change
  110. and as such should be noted.
  111. </para>
  112. </sect3>
  113. <sect3 id="migration.19.zend.http.client.getparamsrecursize">
  114. <title>Deprecation of Zend_Http_Client::_getParametersRecursive()</title>
  115. <para>
  116. Starting from version 1.9, the protected method <methodname>_getParametersRecursive()</methodname>
  117. is no longer used by <classname>Zend_Http_Client</classname> and is deprecated.
  118. Using it will cause an E_NOTICE message to be emitted by <acronym>PHP</acronym>.
  119. </para>
  120. <para>
  121. If you subclass <classname>Zend_Http_Client</classname> and call this method, you
  122. should look into using the <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
  123. static method instead.
  124. </para>
  125. <para>
  126. Again, since this <classname>_getParametersRecursive</classname> is a protected method,
  127. this change will only affect users who subclass <classname>Zend_Http_Client</classname>.
  128. </para>
  129. </sect3>
  130. </sect2>
  131. <sect2 id="migration.19.zend.locale">
  132. <title>Zend_Locale</title>
  133. <sect3 id="migration.19.zend.locale.depreciated">
  134. <title>Depreciated methods</title>
  135. <para>
  136. Some specialized translation methods have been depreciated because they duplicate
  137. existing behaviour. Note that the old methods will still work, but a user notice is
  138. triggered which describes the new call. The methods will be erased with 2.0.
  139. See the following list for old and new method call.
  140. </para>
  141. <table id="migration.19.zend.locale.depreciated.table-1">
  142. <title>List of measurement types</title>
  143. <tgroup cols="2">
  144. <thead>
  145. <row>
  146. <entry>Old call</entry>
  147. <entry>New call</entry>
  148. </row>
  149. </thead>
  150. <tbody>
  151. <row>
  152. <entry>getLanguageTranslationList($locale)</entry>
  153. <entry>getTranslationList('language', $locale)</entry>
  154. </row>
  155. <row>
  156. <entry>getScriptTranslationList($locale)</entry>
  157. <entry>getTranslationList('script', $locale)</entry>
  158. </row>
  159. <row>
  160. <entry>getCountryTranslationList($locale)</entry>
  161. <entry>getTranslationList('territory', $locale, 2)</entry>
  162. </row>
  163. <row>
  164. <entry>getTerritoryTranslationList($locale)</entry>
  165. <entry>getTranslationList('territory', $locale, 1)</entry>
  166. </row>
  167. <row>
  168. <entry>getLanguageTranslation($value, $locale)</entry>
  169. <entry>getTranslation($value, 'language', $locale)</entry>
  170. </row>
  171. <row>
  172. <entry>getScriptTranslation($value, $locale)</entry>
  173. <entry>getTranslation($value, 'script', $locale)</entry>
  174. </row>
  175. <row>
  176. <entry>getCountryTranslation($value, $locale)</entry>
  177. <entry>getTranslation($value, 'country', $locale)</entry>
  178. </row>
  179. <row>
  180. <entry>getTerritoryTranslation($value, $locale)</entry>
  181. <entry>getTranslation($value, 'territory', $locale)</entry>
  182. </row>
  183. </tbody>
  184. </tgroup>
  185. </table>
  186. </sect3>
  187. </sect2>
  188. <sect2 id="migration.19.zend.view.helper.navigation">
  189. <title>Zend_View_Helper_Navigation</title>
  190. <para>
  191. Prior to the 1.9 release, the menu helper
  192. (<classname>Zend_View_Helper_Navigation_Menu</classname>) did not
  193. render sub menus correctly. When the <code>onlyActiveBranch</code>
  194. was <constant>TRUE</constant> and the option <code>renderParents</code>
  195. <constant>FALSE</constant>, nothing would be rendered if the deepest active
  196. page was at a depth lower than the <code>minDepth</code> option.
  197. </para>
  198. <para>
  199. In simpler words; if <code>minDepth</code> was set to <code>1</code>
  200. and the active page was at one of the first level pages, nothing
  201. would be rendered, as the following example shows.
  202. </para>
  203. <para>
  204. Consider the following container setup:
  205. </para>
  206. <programlisting language="php"><![CDATA[
  207. <?php
  208. $container = new Zend_Navigation(array(
  209. array(
  210. 'label' => 'Home',
  211. 'uri' => '#'
  212. ),
  213. array(
  214. 'label' => 'Products',
  215. 'uri' => '#',
  216. 'active' => true,
  217. 'pages' => array(
  218. array(
  219. 'label' => 'Server',
  220. 'uri' => '#'
  221. ),
  222. array(
  223. 'label' => 'Studio',
  224. 'uri' => '#'
  225. )
  226. )
  227. ),
  228. array(
  229. 'label' => 'Solutions',
  230. 'uri' => '#'
  231. )
  232. ));
  233. ]]></programlisting>
  234. <para>
  235. The following code is used in a view script:
  236. </para>
  237. <programlisting language="php"><![CDATA[
  238. <?php echo $this->navigation()->menu()->renderMenu($container, array(
  239. 'minDepth' => 1,
  240. 'onlyActiveBranch' => true,
  241. 'renderParents' => false
  242. )); ?>
  243. ]]></programlisting>
  244. <para>
  245. Before release 1.9, the code snippet above would output nothing.
  246. </para>
  247. <para>
  248. Since release 1.9, the <methodname>_renderDeepestMenu()</methodname> method in
  249. <classname>Zend_View_Helper_Navigation_Menu</classname> will accept
  250. active pages at one level below <code>minDepth</code>, as long as
  251. the page has children.
  252. </para>
  253. <para>
  254. The same code snippet will now output the following:
  255. </para>
  256. <programlisting language="html"><![CDATA[
  257. <ul class="navigation">
  258. <li>
  259. <a href="#">Server</a>
  260. </li>
  261. <li>
  262. <a href="#">Studio</a>
  263. </li>
  264. </ul>
  265. ]]></programlisting>
  266. </sect2>
  267. </sect1>
  268. <!--
  269. vim:se ts=4 sw=4 et:
  270. -->