com doc/ja: Improve libxml_set_external_entity_loader () docs: reference/libxml/functions/libxml-set-extern al-entity-loader.xml

[email protected] (Yoshinari Takaoka) Tue, 19 Jan 2021 21:40:30 +0000
Newsgroups php.doc.ja
Message-ID <[email protected]>
Commit:    27cffaedfba6709789023733edd8660fc94544f0
Author:    Yoshinari Takaoka <[email protected]>         Wed, 20 Jan 2021 06:40:30 +0900
Parents:   0a66089ec0fda69af41464fe3666a3e1703e9519
Branches:  master

Link:       http://git.php.net/?p=doc/ja.git;a=commitdiff;h=27cffaedfba6709789023733edd8660fc94544f0

Log:
Improve libxml_set_external_entity_loader() docs

We point out that this function can be used to avoid XXE, and is
preferable to `libxml_disable_entity_loader()` in this regard.

We also set up a proper methodsysnopsis for the `$resolver_function`.

Changed paths:
  M  reference/libxml/functions/libxml-set-external-entity-loader.xml


Diff:
diff --git a/reference/libxml/functions/libxml-set-external-entity-loader.xml b/reference/libxml/functions/libxml-set-external-entity-loader.xml
index 4f20e78702..e81516f86e 100644
--- a/reference/libxml/functions/libxml-set-external-entity-loader.xml
+++ b/reference/libxml/functions/libxml-set-external-entity-loader.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: f90df97fa5ebfa6e7fcace04976900d6700467cc Maintainer: takagi Status: ready -->
+<!-- EN-Revision: 0e06ad7d77756a2f390e14d19b823a42ab65892b Maintainer: takagi Status: ready -->
+<!-- Credits: mumumu -->
 
 <refentry xml:id="function.libxml-set-external-entity-loader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
  <refnamediv>
@@ -16,6 +17,9 @@
   </methodsynopsis>
   <para>
    デフォルトの外部エンティティローダーを変更します。
+   たとえ <constant>LIBXML_NOENT</constant> が個別のXMLの操作に設定されている場合でも、
+   XXE攻撃を避けるために、任意の外部エンティティの展開を抑制するために使います。
+   <function>libxml_disable_entity_loader</function> を呼び出すことが通常は好ましいです。
   </para>
  </refsect1>
 
@@ -26,10 +30,44 @@
     <term><parameter>resolver_function</parameter></term>
     <listitem>
      <para>
-      三つの引数をとる <type>callable</type>。はじめの二つは文字列でそれぞれ
-      パブリック ID とシステム ID で、残りの一つはコンテキスト (四つのキーを持つ配列) です。
-      このコールバックの返す値は、リソースまたはリソースをオープンできる文字列あるいは
-      &null; でなければなりません。
+      次のシグネチャを持つ <type>callable</type> を指定します。:
+      <methodsynopsis>
+       <type class="union"><type>resource</type><type>string</type><type>null</type></type><methodname><replaceable>resolver</replaceable></methodname>
+       <methodparam><type>string</type><parameter>public_id</parameter></methodparam>
+       <methodparam><type>string</type><parameter>system_id</parameter></methodparam>
+       <methodparam><type>array</type><parameter>context</parameter></methodparam>
+      </methodsynopsis>
+      <variablelist>
+       <varlistentry>
+        <term><parameter>public_id</parameter></term>
+        <listitem>
+         <simpara>
+          パブリック ID
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><parameter>system_id</parameter></term>
+        <listitem>
+         <simpara>
+          システムID
+         </simpara>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term><parameter>context</parameter></term>
+        <listitem>
+         <simpara>
+          4つのキーを持つ配列。
+          キーは <literal>"directory"</literal>, <literal>"intSubName"</literal>,
+          <literal>"extSubURI"</literal>, <literal>"extSubSystem"</literal> です。
+         </simpara>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+      この <type>callable</type> は、
+      リソースまたはリソースをオープンできる文字列あるいは
+      &null; でなければなりません。&null; を返す場合、エンティティ参照の解決は失敗します。
      </para>
     </listitem>
    </varlistentry>