migration-110.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="migration.110">
  4. <title>Zend Framework 1.10</title>
  5. <para>
  6. When upgrading from a previous release to Zend Framework 1.10 or higher you
  7. should note the following migration notes.
  8. </para>
  9. <sect2 id="migration.110.zend.file.transfer">
  10. <title>Zend_File_Transfer</title>
  11. <sect3 id="migration.110.zend.file.transfer.count">
  12. <title>Count validation</title>
  13. <para>
  14. Before release 1.10 the <classname>MimeType</classname> validator used a wrong
  15. naming. For consistency the following constants have been changed:
  16. </para>
  17. <table id="migration.110.zend.file.transfer.count.table">
  18. <title>Changed Validation Messages</title>
  19. <tgroup cols="4">
  20. <thead>
  21. <row>
  22. <entry>Old</entry>
  23. <entry>New</entry>
  24. <entry>Value</entry>
  25. </row>
  26. </thead>
  27. <tbody>
  28. <row>
  29. <entry><constant>TOO_MUCH</constant></entry>
  30. <entry><constant>TOO_MANY</constant></entry>
  31. <entry>
  32. Too many files, maximum '%max%' are allowed but '%count%' are given
  33. </entry>
  34. </row>
  35. <row>
  36. <entry><constant>TOO_LESS</constant></entry>
  37. <entry><constant>TOO_FEW</constant></entry>
  38. <entry>
  39. Too few files, minimum '%min%' are expected but '%count%' are given
  40. </entry>
  41. </row>
  42. </tbody>
  43. </tgroup>
  44. </table>
  45. <para>
  46. When you are translating these messages within your code then use the new constants.
  47. As benefit you don't need to translate the original string anymore to get a correct
  48. spelling.
  49. </para>
  50. </sect3>
  51. <sect3 id="migration.110.zend.file.transfer.mimetype">
  52. <title>MimeType validation</title>
  53. <para>
  54. For security reasons we had to turn off the default fallback mechanism of the
  55. <classname>MimeType</classname>, <classname>ExcludeMimeType</classname>,
  56. <classname>IsCompressed</classname> and <classname>IsImage</classname> validators.
  57. This means, that if the <emphasis>fileInfo</emphasis> or
  58. <emphasis>magicMime</emphasis> extensions can not be found, the validation will
  59. always fail.
  60. </para>
  61. <para>
  62. If you are in need of validation by using the <acronym>HTTP</acronym> fields which
  63. are provided by the user then you can turn on this feature by using the
  64. <methodname>enableHeaderCheck()</methodname> method.
  65. </para>
  66. <note>
  67. <title>Security hint</title>
  68. <para>
  69. You should note that relying on the <acronym>HTTP</acronym> fields, which are
  70. provided by your user, is a security risk. They can easily be changed and could
  71. allow your user to provide a malcious file.
  72. </para>
  73. </note>
  74. <example id="migration.110.zend.file.transfer.example">
  75. <title>Allow the usage of the HTTP fields</title>
  76. <programlisting language="php"><![CDATA[
  77. // at initiation
  78. $valid = new Zend_File_Transfer_Adapter_Http(array('headerCheck' => true);
  79. // or afterwards
  80. $valid->enableHeaderCheck();
  81. ]]></programlisting>
  82. </example>
  83. </sect3>
  84. </sect2>
  85. <sect2 id="migration.110.zend.validate">
  86. <title>Zend_Validate</title>
  87. <sect3 id="migration.110.zend.validate.selfwritten">
  88. <title>Self written validators</title>
  89. <para>
  90. When setting returning a error from within a self written validator you have to
  91. call the <methodname>_error()</methodname> method. Before Zend Framework 1.10 you
  92. were able to call this method without giving a parameter. It used then the first
  93. found message template.
  94. </para>
  95. <para>
  96. This behaviour is problematic when you have validators with more than one different
  97. message to be returned. Also when you extend an existing validator you can get
  98. unexpected results. This could lead to the problem that your user get not the
  99. message you expected.
  100. </para>
  101. <programlisting language="php"><![CDATA[
  102. My_Validator extends Zend_Validate_Abstract
  103. {
  104. public isValid($value)
  105. {
  106. ...
  107. $this->_error(); // unexpected results between different OS
  108. ...
  109. }
  110. }
  111. ]]></programlisting>
  112. <para>
  113. To prevent this problem the <methodname>_error()</methodname> method is no longer
  114. allowed to be called without giving a parameter.
  115. </para>
  116. <programlisting language="php"><![CDATA[
  117. My_Validator extends Zend_Validate_Abstract
  118. {
  119. public isValid($value)
  120. {
  121. ...
  122. $this->_error(self::MY_ERROR); // defined error, no unexpected results
  123. ...
  124. }
  125. }
  126. ]]></programlisting>
  127. </sect3>
  128. <sect3 id="migration.110.zend.validate.datevalidator">
  129. <title>Simplification in date validator</title>
  130. <para>
  131. Before Zend Framework 1.10 2 identical messages were thrown within the date
  132. validator. These were <constant>NOT_YYYY_MM_DD</constant> and
  133. <constant>FALSEFORMAT</constant>. As of Zend Framework 1.10 only the
  134. <constant>FALSEFORMAT</constant> message will be returned when the given date
  135. does not match the set format.
  136. </para>
  137. </sect3>
  138. <sect3 id="migration.110.zend.validate.barcodevalidator">
  139. <title>Fixes in Alpha, Alnum and Barcode validator</title>
  140. <para>
  141. Before Zend Framework 1.10 the messages within the 2 barcode adapters, the Alpha
  142. and the Alnum validator were identical. This introduced problems when using custom
  143. messages, translations or multiple instances of these validators.
  144. </para>
  145. <para>
  146. As with Zend Framework 1.10 the values of the constants were changed to
  147. be unique. When you used the constants as proposed in the manual there is
  148. no change for you. But when you used the content of the constants in your code
  149. then you will have to change them. The following table shows you the changed values:
  150. </para>
  151. <table id="migration.110.zend.validate.barcodevalidator.table">
  152. <title>Available Validation Messages</title>
  153. <tgroup cols="3">
  154. <thead>
  155. <row>
  156. <entry>Validator</entry>
  157. <entry>Constant</entry>
  158. <entry>Value</entry>
  159. </row>
  160. </thead>
  161. <tbody>
  162. <row>
  163. <entry>Alnum</entry>
  164. <entry><constant>STRING_EMPTY</constant></entry>
  165. <entry>alnumStringEmpty</entry>
  166. </row>
  167. <row>
  168. <entry>Alpha</entry>
  169. <entry><constant>STRING_EMPTY</constant></entry>
  170. <entry>alphaStringEmpty</entry>
  171. </row>
  172. <row>
  173. <entry>Barcode_Ean13</entry>
  174. <entry><constant>INVALID</constant></entry>
  175. <entry>ean13Invalid</entry>
  176. </row>
  177. <row>
  178. <entry>Barcode_Ean13</entry>
  179. <entry><constant>INVALID_LENGTH</constant></entry>
  180. <entry>ean13InvalidLength</entry>
  181. </row>
  182. <row>
  183. <entry>Barcode_UpcA</entry>
  184. <entry><constant>INVALID</constant></entry>
  185. <entry>upcaInvalid</entry>
  186. </row>
  187. <row>
  188. <entry>Barcode_UpcA</entry>
  189. <entry><constant>INVALID_LENGTH</constant></entry>
  190. <entry>upcaInvalidLength</entry>
  191. </row>
  192. <row>
  193. <entry>Digits</entry>
  194. <entry><constant>STRING_EMPTY</constant></entry>
  195. <entry>digitsStringEmpty</entry>
  196. </row>
  197. </tbody>
  198. </tgroup>
  199. </table>
  200. </sect3>
  201. </sect2>
  202. </sect1>
  203. <!--
  204. vim:se ts=4 sw=4 et:
  205. -->