| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <!-- EN-Revision: 24249 -->
- <sect1 id="migration.19">
- <title>Zend Framework 1.9(一部日本語)</title>
- <para>
- 1.9.0 よりも前にリリースされた Zend Framework から 1.9 のどのリリースに更新する際でも、
- 下記の移行上の注意点に注意すべきです。
- </para>
- <sect2 id="migration.19.zend.file.transfer">
- <title>Zend_File_Transfer</title>
- <sect3 id="migration.19.zend.file.transfer.mimetype">
- <title>MimeType の検証</title>
- <para>
- セキュリティ上の理由から、
- <classname>MimeType</classname>、<classname>ExcludeMimeType</classname>、
- <classname>IsCompressed</classname> および <classname>IsImage</classname>
- バリデータにおけるデフォルトのフォールバック機能を無効にしました。
- つまり、<emphasis>fileInfo</emphasis> 拡張モジュールあるいは
- <emphasis>magicMime</emphasis> 拡張モジュールがなければ、
- 検証が常に失敗するようになるということです。
- </para>
- <para>
- ユーザ側から渡された <acronym>HTTP</acronym> フィールドを使用して入力を検証する必要がある場合は、
- <methodname>enableHeaderCheck()</methodname> メソッドを使用すればこの機能を有効にできます。
- </para>
- <note>
- <title>セキュリティに関するヒント</title>
- <para>
- ユーザ側から渡された <acronym>HTTP</acronym>
- フィールドに依存するのはセキュリティ上のリスクとなることに注意しましょう。
- これは簡単に改ざんすることができ、悪意のあるファイルを受け取る可能性があります。
- </para>
- </note>
- <example id="migration.19.zend.file.transfer.example">
- <title>HTTP フィールドの使用を許可する</title>
- <programlisting language="php"><![CDATA[
- // 初期化時に
- $valid = new Zend_File_Transfer_Adapter_Http(array('headerCheck' => true);
- // あるいは後から
- $valid->enableHeaderCheck();
- ]]></programlisting>
- </example>
- </sect3>
- </sect2>
- <sect2 id="migration.19.zend.filter">
- <title>Zend_Filter</title>
- <para>
- 1.9のリリース以前は、<classname>Zend_Filter</classname>では、
- static <methodname>get()</methodname>メソッドを使うことができました。
- リリース1.9と同時に、このメソッドは、より描写的な
- <methodname>filterStatic()</methodname>に名前を変更されました。
- 古い <methodname>get()</methodname> メソッドは非推奨に区分されます。
- </para>
- </sect2>
- <sect2 id="migration.19.zend.http.client">
- <title>Zend_Http_Client</title>
- <sect3 id="migration.19.zend.http.client.fileuploadsarray">
- <title>内部のアップロードされたファイル情報ストレージに変更</title>
- <para>
- Zend Framework のバージョン 1.9 では、
- アップロードされるファイルに関する情報を
- <classname>Zend_Http_Client</classname>が内部的に格納し、
- <methodname>Zend_Http_Client::setFileUpload()</methodname>メソッドを用いてセットする
- 方法で変化がありました。
- </para>
- <para>
- 複数のファイルを同じフォーム名で
- ファイルの配列としてアップロードできるように
- この変化が取り入れられました。
- この問題に関するより多くの情報は、<ulink
- url="http://framework.zend.com/issues/browse/ZF-5744">このバグ・レポート</ulink>
- で見つけられます。
- </para>
- <example id="migration.19.zend.http.client.fileuploadsarray.example">
- <title>アップロードされたファイル情報の内部ストレージ</title>
- <programlisting language="php"><![CDATA[
- // ファイル2つを同じフォーム要素名でファイルの配列としてアップロード
- $client = new Zend_Http_Client();
- $client->setFileUpload('file1.txt',
- 'userfile[]',
- 'some raw data',
- 'text/plain');
- $client->setFileUpload('file2.txt',
- 'userfile[]',
- 'some other data',
- 'application/octet-stream');
- // Zend Framework の 1.8 以前では、
- // protected メンバー $client->files の値はこうです:
- // $client->files = array(
- // 'userfile[]' => array('file2.txt',
- 'application/octet-stream',
- 'some other data')
- // );
- // Zend Framework の 1.9 以降では、$client->files の値はこうです:
- // $client->files = array(
- // array(
- // 'formname' => 'userfile[]',
- // 'filename' => 'file1.txt,
- // 'ctype' => 'text/plain',
- // 'data' => 'some raw data'
- // ),
- // array(
- // 'formname' => 'userfile[]',
- // 'filename' => 'file2.txt',
- // 'formname' => 'application/octet-stream',
- // 'formname' => 'some other data'
- // )
- // );
- ]]></programlisting>
- </example>
- <para>
- ご覧の通り、この変化は1つ以上のファイルで同じフォーム要素名を使えるようにします。
- しかし、それは微妙な下位互換性変化を取り入れるので、そのように注意するべきです。
- </para>
- </sect3>
- <sect3 id="migration.19.zend.http.client.getparamsrecursize">
- <title>Zend_Http_Client::_getParametersRecursive() の廃止</title>
- <para>
- バージョン1.9から始まりますが、
- protected メソッド <methodname>_getParametersRecursive()</methodname> はもはや
- <classname>Zend_Http_Client</classname> に使われず、廃止されます。
- それを使うと、 <constant>E_NOTICE</constant> メッセージが<acronym>PHP</acronym>によって発生する原因になります。
- </para>
- <para>
- <classname>Zend_Http_Client</classname>をサブクラスとして、このメソッドを呼ぶなら、
- その代わりに <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
- static メソッドを使用することに目を向けるべきです。
- </para>
- <para>
- また、この<methodname>_getParametersRecursive</methodname>は protected メソッドなので、
- この変化は<classname>Zend_Http_Client</classname>をサブクラスとするユーザーに
- 影響を及ぼすだけです。
- </para>
- </sect3>
- </sect2>
- <sect2 id="migration.19.zend.locale">
- <title>Zend_Locale</title>
- <sect3 id="migration.19.zend.locale.deprecated">
- <title>非推奨となるメソッド</title>
- <para>
- 特別に用意されていたメソッドのいくつかが非推奨となります。
- 既存の挙動と重複しているからです。
- 古いメソッドも動作するにはしますが、
- 新しいメソッドについて説明する user notice が発生することに注意しましょう。
- これらのメソッドは 2.0 で削除されます。
- 次の一覧で、新旧のメソッドコールを参照ください。
- </para>
- <table id="migration.19.zend.locale.deprecated.table-1">
- <title>新旧のメソッドコールの一覧</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>古い方法</entry>
- <entry>新しい方法</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <methodname>getLanguageTranslationList($locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslationList('language', $locale)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getScriptTranslationList($locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslationList('script', $locale)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getCountryTranslationList($locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslationList('territory', $locale, 2)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getTerritoryTranslationList($locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslationList('territory', $locale, 1)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getLanguageTranslation($value, $locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslation($value, 'language', $locale)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getScriptTranslation($value, $locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslation($value, 'script', $locale)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getCountryTranslation($value, $locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslation($value, 'country', $locale)</methodname>
- </entry>
- </row>
- <row>
- <entry>
- <methodname>getTerritoryTranslation($value, $locale)</methodname>
- </entry>
- <entry>
- <methodname>getTranslation($value, 'territory', $locale)</methodname>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect3>
- </sect2>
- <sect2 id="migration.19.zend.view.helper.navigation">
- <title>Zend_View_Helper_Navigation</title>
- <para>
- 1.9のリリースより前は、
- メニュー・ヘルパー (<classname>Zend_View_Helper_Navigation_Menu</classname>) は、
- サブメニューを正しく生成しませんでした。
- <property>onlyActiveBranch</property> が <constant>TRUE</constant> で、
- オプションの <property>renderParents</property> が <constant>FALSE</constant> のとき、
- もし、最も深いアクティブなページが <property>minDepth</property> オプションより低い階層にあると、
- 何もレンダリングされないでしょう。
- </para>
- <para>
- より簡単に言うと、もし <property>minDepth</property> が '1' に設定され、
- アクティブなページが最初のレベルのページの一つなら、
- 以下の例が示すように、何もレンダリングされないでしょう。
- </para>
- <para>
- 下記のコンテナのセットアップを考えて見ましょう。
- </para>
- <programlisting language="php"><![CDATA[
- <?php
- $container = new Zend_Navigation(array(
- array(
- 'label' => 'Home',
- 'uri' => '#'
- ),
- array(
- 'label' => 'Products',
- 'uri' => '#',
- 'active' => true,
- 'pages' => array(
- array(
- 'label' => 'Server',
- 'uri' => '#'
- ),
- array(
- 'label' => 'Studio',
- 'uri' => '#'
- )
- )
- ),
- array(
- 'label' => 'Solutions',
- 'uri' => '#'
- )
- ));
- ]]></programlisting>
- <para>
- 下記のコードがビュースクリプトで使用されます。
- </para>
- <programlisting language="php"><![CDATA[
- <?php echo $this->navigation()->menu()->renderMenu($container, array(
- 'minDepth' => 1,
- 'onlyActiveBranch' => true,
- 'renderParents' => false
- )); ?>
- ]]></programlisting>
- <para>
- リリース1.9より前は、上記のコードスニペットは、何も出力しません。
- </para>
- <para>
- リリース1.9以降では、ページの子供がある限り、
- <classname>Zend_View_Helper_Navigation_Menu</classname> の <methodname>_renderDeepestMenu()</methodname>
- メソッドは <property>minDepth</property> の1階層下のアクティブページを受け取ります。
- </para>
- <para>
- 今では、同じコードスニペットで下記を出力します。
- </para>
- <programlisting language="html"><![CDATA[
- <ul class="navigation">
- <li>
- <a href="#">Server</a>
- </li>
- <li>
- <a href="#">Studio</a>
- </li>
- </ul>
- ]]></programlisting>
- </sect2>
- <sect2 id="migration.19.security">
- <title>1.9.7 でのセキュリティーフィックス</title>
- <!-- TODO : to be translated -->
- <para>
- Additionally, users of the 1.9 series may be affected by other changes starting in
- version 1.9.7. These are all security fixes that also have potential backwards
- compatibility implications.
- </para>
- <sect3 id="migration.19.security.zend.dojo.editor">
- <title>Zend_Dojo_View_Helper_Editor</title>
- <para>
- A slight change was made in the 1.9 series to modify the default usage of the Editor
- dijit to use <acronym>div</acronym> tags instead of a <acronym>textarea</acronym>
- tag; the latter usage has <ulink
- url="http://api.dojotoolkit.org/jsdoc/HEAD/dijit._editor.RichText">security
- implications</ulink>, and usage of <acronym>div</acronym> tags is recommended by the
- Dojo project.
- </para>
- <para>
- In order to still allow graceful degradation, a new <varname>degrade</varname>
- option was added to the view helper; this would allow developers to optionally use a
- <acronym>textarea</acronym> instead. However, this opens applications developed with
- that usage to <acronym>XSS</acronym> vectors. In 1.9.7, we have removed this option.
- Graceful degradation is still supported, however, via a <acronym>noscript</acronym>
- tag that embeds a <acronym>textarea</acronym>. This solution addressess all security
- concerns.
- </para>
- <para>
- The takeaway is that if you were using the <varname>degrade</varname> flag, it will
- simply be ignored at this time.
- </para>
- </sect3>
- <sect3 id="migration.19.security.zend.filter.html-entities">
- <title>Zend_Filter_HtmlEntities</title>
- <para>
- よりセキュアな文字エンコードを既定値にするために、
- <classname>Zend_Filter_HtmlEntities</classname> は、
- <acronym>ISO-8859-1</acronym> の代わりに
- <acronym>UTF-8</acronym> を既定値にしました。
- </para>
- <!-- TODO : to be translated -->
- <para>
- Additionally, because the actual mechanism is dealing with character encodings and
- not character sets, two new methods have been added,
- <methodname>setEncoding()</methodname> and <methodname>getEncoding()</methodname>.
- The previous methods <methodname>setCharSet()</methodname> and
- <methodname>setCharSet()</methodname> are now deprecated and proxy to the new
- methods. Finally, instead of using the protected members directly within the
- <methodname>filter()</methodname> method, these members are retrieved by their
- explicit accessors. If you were extending the filter in the past, please check your
- code and unit tests to ensure everything still continues to work.
- </para>
- </sect3>
- <sect3 id="migration.19.security.zend.filter.strip-tags">
- <title>Zend_Filter_StripTags</title>
- <para>
- <classname>Zend_Filter_StripTags</classname> contains a flag,
- <varname>commentsAllowed</varname>, that, in previous versions, allowed you to
- optionally whitelist <acronym>HTML</acronym> comments in <acronym>HTML</acronym>
- text filtered by the class. However, this opens code enabling the flag to
- <acronym>XSS</acronym> attacks, particularly in Internet Explorer (which allows
- specifying conditional functionality via <acronym>HTML</acronym> comments). Starting
- in version 1.9.7 (and backported to versions 1.8.5 and 1.7.9), the
- <varname>commentsAllowed</varname> flag no longer has any meaning, and all
- <acronym>HTML</acronym> comments, including those containing other
- <acronym>HTML</acronym> tags or nested commments, will be stripped from the final
- output of the filter.
- </para>
- </sect3>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|