migration-19.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 24249 -->
  4. <sect1 id="migration.19">
  5. <title>Zend Framework 1.9(一部日本語)</title>
  6. <para>
  7. 1.9.0 よりも前にリリースされた Zend Framework から 1.9 のどのリリースに更新する際でも、
  8. 下記の移行上の注意点に注意すべきです。
  9. </para>
  10. <sect2 id="migration.19.zend.file.transfer">
  11. <title>Zend_File_Transfer</title>
  12. <sect3 id="migration.19.zend.file.transfer.mimetype">
  13. <title>MimeType の検証</title>
  14. <para>
  15. セキュリティ上の理由から、
  16. <classname>MimeType</classname>、<classname>ExcludeMimeType</classname>、
  17. <classname>IsCompressed</classname> および <classname>IsImage</classname>
  18. バリデータにおけるデフォルトのフォールバック機能を無効にしました。
  19. つまり、<emphasis>fileInfo</emphasis> 拡張モジュールあるいは
  20. <emphasis>magicMime</emphasis> 拡張モジュールがなければ、
  21. 検証が常に失敗するようになるということです。
  22. </para>
  23. <para>
  24. ユーザ側から渡された <acronym>HTTP</acronym> フィールドを使用して入力を検証する必要がある場合は、
  25. <methodname>enableHeaderCheck()</methodname> メソッドを使用すればこの機能を有効にできます。
  26. </para>
  27. <note>
  28. <title>セキュリティに関するヒント</title>
  29. <para>
  30. ユーザ側から渡された <acronym>HTTP</acronym>
  31. フィールドに依存するのはセキュリティ上のリスクとなることに注意しましょう。
  32. これは簡単に改ざんすることができ、悪意のあるファイルを受け取る可能性があります。
  33. </para>
  34. </note>
  35. <example id="migration.19.zend.file.transfer.example">
  36. <title>HTTP フィールドの使用を許可する</title>
  37. <programlisting language="php"><![CDATA[
  38. // 初期化時に
  39. $valid = new Zend_File_Transfer_Adapter_Http(array('headerCheck' => true);
  40. // あるいは後から
  41. $valid->enableHeaderCheck();
  42. ]]></programlisting>
  43. </example>
  44. </sect3>
  45. </sect2>
  46. <sect2 id="migration.19.zend.filter">
  47. <title>Zend_Filter</title>
  48. <para>
  49. 1.9のリリース以前は、<classname>Zend_Filter</classname>では、
  50. static <methodname>get()</methodname>メソッドを使うことができました。
  51. リリース1.9と同時に、このメソッドは、より描写的な
  52. <methodname>filterStatic()</methodname>に名前を変更されました。
  53. 古い <methodname>get()</methodname> メソッドは非推奨に区分されます。
  54. </para>
  55. </sect2>
  56. <sect2 id="migration.19.zend.http.client">
  57. <title>Zend_Http_Client</title>
  58. <sect3 id="migration.19.zend.http.client.fileuploadsarray">
  59. <title>内部のアップロードされたファイル情報ストレージに変更</title>
  60. <para>
  61. Zend Framework のバージョン 1.9 では、
  62. アップロードされるファイルに関する情報を
  63. <classname>Zend_Http_Client</classname>が内部的に格納し、
  64. <methodname>Zend_Http_Client::setFileUpload()</methodname>メソッドを用いてセットする
  65. 方法で変化がありました。
  66. </para>
  67. <para>
  68. 複数のファイルを同じフォーム名で
  69. ファイルの配列としてアップロードできるように
  70. この変化が取り入れられました。
  71. この問題に関するより多くの情報は、<ulink
  72. url="http://framework.zend.com/issues/browse/ZF-5744">このバグ・レポート</ulink>
  73. で見つけられます。
  74. </para>
  75. <example id="migration.19.zend.http.client.fileuploadsarray.example">
  76. <title>アップロードされたファイル情報の内部ストレージ</title>
  77. <programlisting language="php"><![CDATA[
  78. // ファイル2つを同じフォーム要素名でファイルの配列としてアップロード
  79. $client = new Zend_Http_Client();
  80. $client->setFileUpload('file1.txt',
  81. 'userfile[]',
  82. 'some raw data',
  83. 'text/plain');
  84. $client->setFileUpload('file2.txt',
  85. 'userfile[]',
  86. 'some other data',
  87. 'application/octet-stream');
  88. // Zend Framework の 1.8 以前では、
  89. // protected メンバー $client->files の値はこうです:
  90. // $client->files = array(
  91. // 'userfile[]' => array('file2.txt',
  92. 'application/octet-stream',
  93. 'some other data')
  94. // );
  95. // Zend Framework の 1.9 以降では、$client->files の値はこうです:
  96. // $client->files = array(
  97. // array(
  98. // 'formname' => 'userfile[]',
  99. // 'filename' => 'file1.txt,
  100. // 'ctype' => 'text/plain',
  101. // 'data' => 'some raw data'
  102. // ),
  103. // array(
  104. // 'formname' => 'userfile[]',
  105. // 'filename' => 'file2.txt',
  106. // 'formname' => 'application/octet-stream',
  107. // 'formname' => 'some other data'
  108. // )
  109. // );
  110. ]]></programlisting>
  111. </example>
  112. <para>
  113. ご覧の通り、この変化は1つ以上のファイルで同じフォーム要素名を使えるようにします。
  114. しかし、それは微妙な下位互換性変化を取り入れるので、そのように注意するべきです。
  115. </para>
  116. </sect3>
  117. <sect3 id="migration.19.zend.http.client.getparamsrecursize">
  118. <title>Zend_Http_Client::_getParametersRecursive() の廃止</title>
  119. <para>
  120. バージョン1.9から始まりますが、
  121. protected メソッド <methodname>_getParametersRecursive()</methodname> はもはや
  122. <classname>Zend_Http_Client</classname> に使われず、廃止されます。
  123. それを使うと、 <constant>E_NOTICE</constant> メッセージが<acronym>PHP</acronym>によって発生する原因になります。
  124. </para>
  125. <para>
  126. <classname>Zend_Http_Client</classname>をサブクラスとして、このメソッドを呼ぶなら、
  127. その代わりに <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
  128. static メソッドを使用することに目を向けるべきです。
  129. </para>
  130. <para>
  131. また、この<methodname>_getParametersRecursive</methodname>は protected メソッドなので、
  132. この変化は<classname>Zend_Http_Client</classname>をサブクラスとするユーザーに
  133. 影響を及ぼすだけです。
  134. </para>
  135. </sect3>
  136. </sect2>
  137. <sect2 id="migration.19.zend.locale">
  138. <title>Zend_Locale</title>
  139. <sect3 id="migration.19.zend.locale.deprecated">
  140. <title>非推奨となるメソッド</title>
  141. <para>
  142. 特別に用意されていたメソッドのいくつかが非推奨となります。
  143. 既存の挙動と重複しているからです。
  144. 古いメソッドも動作するにはしますが、
  145. 新しいメソッドについて説明する user notice が発生することに注意しましょう。
  146. これらのメソッドは 2.0 で削除されます。
  147. 次の一覧で、新旧のメソッドコールを参照ください。
  148. </para>
  149. <table id="migration.19.zend.locale.deprecated.table-1">
  150. <title>新旧のメソッドコールの一覧</title>
  151. <tgroup cols="2">
  152. <thead>
  153. <row>
  154. <entry>古い方法</entry>
  155. <entry>新しい方法</entry>
  156. </row>
  157. </thead>
  158. <tbody>
  159. <row>
  160. <entry>
  161. <methodname>getLanguageTranslationList($locale)</methodname>
  162. </entry>
  163. <entry>
  164. <methodname>getTranslationList('language', $locale)</methodname>
  165. </entry>
  166. </row>
  167. <row>
  168. <entry>
  169. <methodname>getScriptTranslationList($locale)</methodname>
  170. </entry>
  171. <entry>
  172. <methodname>getTranslationList('script', $locale)</methodname>
  173. </entry>
  174. </row>
  175. <row>
  176. <entry>
  177. <methodname>getCountryTranslationList($locale)</methodname>
  178. </entry>
  179. <entry>
  180. <methodname>getTranslationList('territory', $locale, 2)</methodname>
  181. </entry>
  182. </row>
  183. <row>
  184. <entry>
  185. <methodname>getTerritoryTranslationList($locale)</methodname>
  186. </entry>
  187. <entry>
  188. <methodname>getTranslationList('territory', $locale, 1)</methodname>
  189. </entry>
  190. </row>
  191. <row>
  192. <entry>
  193. <methodname>getLanguageTranslation($value, $locale)</methodname>
  194. </entry>
  195. <entry>
  196. <methodname>getTranslation($value, 'language', $locale)</methodname>
  197. </entry>
  198. </row>
  199. <row>
  200. <entry>
  201. <methodname>getScriptTranslation($value, $locale)</methodname>
  202. </entry>
  203. <entry>
  204. <methodname>getTranslation($value, 'script', $locale)</methodname>
  205. </entry>
  206. </row>
  207. <row>
  208. <entry>
  209. <methodname>getCountryTranslation($value, $locale)</methodname>
  210. </entry>
  211. <entry>
  212. <methodname>getTranslation($value, 'country', $locale)</methodname>
  213. </entry>
  214. </row>
  215. <row>
  216. <entry>
  217. <methodname>getTerritoryTranslation($value, $locale)</methodname>
  218. </entry>
  219. <entry>
  220. <methodname>getTranslation($value, 'territory', $locale)</methodname>
  221. </entry>
  222. </row>
  223. </tbody>
  224. </tgroup>
  225. </table>
  226. </sect3>
  227. </sect2>
  228. <sect2 id="migration.19.zend.view.helper.navigation">
  229. <title>Zend_View_Helper_Navigation</title>
  230. <para>
  231. 1.9のリリースより前は、
  232. メニュー・ヘルパー (<classname>Zend_View_Helper_Navigation_Menu</classname>) は、
  233. サブメニューを正しく生成しませんでした。
  234. <property>onlyActiveBranch</property> が <constant>TRUE</constant> で、
  235. オプションの <property>renderParents</property> が <constant>FALSE</constant> のとき、
  236. もし、最も深いアクティブなページが <property>minDepth</property> オプションより低い階層にあると、
  237. 何もレンダリングされないでしょう。
  238. </para>
  239. <para>
  240. より簡単に言うと、もし <property>minDepth</property> が '1' に設定され、
  241. アクティブなページが最初のレベルのページの一つなら、
  242. 以下の例が示すように、何もレンダリングされないでしょう。
  243. </para>
  244. <para>
  245. 下記のコンテナのセットアップを考えて見ましょう。
  246. </para>
  247. <programlisting language="php"><![CDATA[
  248. <?php
  249. $container = new Zend_Navigation(array(
  250. array(
  251. 'label' => 'Home',
  252. 'uri' => '#'
  253. ),
  254. array(
  255. 'label' => 'Products',
  256. 'uri' => '#',
  257. 'active' => true,
  258. 'pages' => array(
  259. array(
  260. 'label' => 'Server',
  261. 'uri' => '#'
  262. ),
  263. array(
  264. 'label' => 'Studio',
  265. 'uri' => '#'
  266. )
  267. )
  268. ),
  269. array(
  270. 'label' => 'Solutions',
  271. 'uri' => '#'
  272. )
  273. ));
  274. ]]></programlisting>
  275. <para>
  276. 下記のコードがビュースクリプトで使用されます。
  277. </para>
  278. <programlisting language="php"><![CDATA[
  279. <?php echo $this->navigation()->menu()->renderMenu($container, array(
  280. 'minDepth' => 1,
  281. 'onlyActiveBranch' => true,
  282. 'renderParents' => false
  283. )); ?>
  284. ]]></programlisting>
  285. <para>
  286. リリース1.9より前は、上記のコードスニペットは、何も出力しません。
  287. </para>
  288. <para>
  289. リリース1.9以降では、ページの子供がある限り、
  290. <classname>Zend_View_Helper_Navigation_Menu</classname> の <methodname>_renderDeepestMenu()</methodname>
  291. メソッドは <property>minDepth</property> の1階層下のアクティブページを受け取ります。
  292. </para>
  293. <para>
  294. 今では、同じコードスニペットで下記を出力します。
  295. </para>
  296. <programlisting language="html"><![CDATA[
  297. <ul class="navigation">
  298. <li>
  299. <a href="#">Server</a>
  300. </li>
  301. <li>
  302. <a href="#">Studio</a>
  303. </li>
  304. </ul>
  305. ]]></programlisting>
  306. </sect2>
  307. <sect2 id="migration.19.security">
  308. <title>1.9.7 でのセキュリティーフィックス</title>
  309. <!-- TODO : to be translated -->
  310. <para>
  311. Additionally, users of the 1.9 series may be affected by other changes starting in
  312. version 1.9.7. These are all security fixes that also have potential backwards
  313. compatibility implications.
  314. </para>
  315. <sect3 id="migration.19.security.zend.dojo.editor">
  316. <title>Zend_Dojo_View_Helper_Editor</title>
  317. <para>
  318. A slight change was made in the 1.9 series to modify the default usage of the Editor
  319. dijit to use <acronym>div</acronym> tags instead of a <acronym>textarea</acronym>
  320. tag; the latter usage has <ulink
  321. url="http://api.dojotoolkit.org/jsdoc/HEAD/dijit._editor.RichText">security
  322. implications</ulink>, and usage of <acronym>div</acronym> tags is recommended by the
  323. Dojo project.
  324. </para>
  325. <para>
  326. In order to still allow graceful degradation, a new <varname>degrade</varname>
  327. option was added to the view helper; this would allow developers to optionally use a
  328. <acronym>textarea</acronym> instead. However, this opens applications developed with
  329. that usage to <acronym>XSS</acronym> vectors. In 1.9.7, we have removed this option.
  330. Graceful degradation is still supported, however, via a <acronym>noscript</acronym>
  331. tag that embeds a <acronym>textarea</acronym>. This solution addressess all security
  332. concerns.
  333. </para>
  334. <para>
  335. The takeaway is that if you were using the <varname>degrade</varname> flag, it will
  336. simply be ignored at this time.
  337. </para>
  338. </sect3>
  339. <sect3 id="migration.19.security.zend.filter.html-entities">
  340. <title>Zend_Filter_HtmlEntities</title>
  341. <para>
  342. よりセキュアな文字エンコードを既定値にするために、
  343. <classname>Zend_Filter_HtmlEntities</classname> は、
  344. <acronym>ISO-8859-1</acronym> の代わりに
  345. <acronym>UTF-8</acronym> を既定値にしました。
  346. </para>
  347. <!-- TODO : to be translated -->
  348. <para>
  349. Additionally, because the actual mechanism is dealing with character encodings and
  350. not character sets, two new methods have been added,
  351. <methodname>setEncoding()</methodname> and <methodname>getEncoding()</methodname>.
  352. The previous methods <methodname>setCharSet()</methodname> and
  353. <methodname>setCharSet()</methodname> are now deprecated and proxy to the new
  354. methods. Finally, instead of using the protected members directly within the
  355. <methodname>filter()</methodname> method, these members are retrieved by their
  356. explicit accessors. If you were extending the filter in the past, please check your
  357. code and unit tests to ensure everything still continues to work.
  358. </para>
  359. </sect3>
  360. <sect3 id="migration.19.security.zend.filter.strip-tags">
  361. <title>Zend_Filter_StripTags</title>
  362. <para>
  363. <classname>Zend_Filter_StripTags</classname> contains a flag,
  364. <varname>commentsAllowed</varname>, that, in previous versions, allowed you to
  365. optionally whitelist <acronym>HTML</acronym> comments in <acronym>HTML</acronym>
  366. text filtered by the class. However, this opens code enabling the flag to
  367. <acronym>XSS</acronym> attacks, particularly in Internet Explorer (which allows
  368. specifying conditional functionality via <acronym>HTML</acronym> comments). Starting
  369. in version 1.9.7 (and backported to versions 1.8.5 and 1.7.9), the
  370. <varname>commentsAllowed</varname> flag no longer has any meaning, and all
  371. <acronym>HTML</acronym> comments, including those containing other
  372. <acronym>HTML</acronym> tags or nested commments, will be stripped from the final
  373. output of the filter.
  374. </para>
  375. </sect3>
  376. </sect2>
  377. </sect1>
  378. <!--
  379. vim:se ts=4 sw=4 et:
  380. -->