diff --git a/appendices/ini.core.xml b/appendices/ini.core.xml index 2f2dc06970..00156b766d 100644 --- a/appendices/ini.core.xml +++ b/appendices/ini.core.xml @@ -1,6 +1,6 @@ - +
@@ -222,6 +222,12 @@ このディレクティブは &php.ini; で設定しなければなりません。 &httpd.conf; では設定できません。 + + + このディレクティブは迂回可能であり、共有ホスティング環境における + 十分なセキュリティ対策とはみなすべきではありません。 + + @@ -244,6 +250,12 @@ このディレクティブは &php.ini; で設定しなければなりません。 &httpd.conf; では設定できません。 + + + このディレクティブは迂回可能であり、共有ホスティング環境における + 十分なセキュリティ対策とはみなすべきではありません。 + + diff --git a/appendices/migration81/constants.xml b/appendices/migration81/constants.xml index 254c005715..4fa1fb54c3 100644 --- a/appendices/migration81/constants.xml +++ b/appendices/migration81/constants.xml @@ -1,6 +1,6 @@ - + 新しいグローバル定数 @@ -148,6 +148,16 @@ + + 標準ライブラリ + + + + IMAGETYPE_AVIF + + + + Tokenizer diff --git a/language/enumerations.xml b/language/enumerations.xml index d18264f7b8..d35561f3f0 100644 --- a/language/enumerations.xml +++ b/language/enumerations.xml @@ -1,6 +1,6 @@ - + 列挙型(Enum) @@ -121,6 +121,8 @@ $b = Suit::Spades; $a === $b; // true $a instanceof Suit; // true + +$a !== 'Spades'; // true ?> ]]> diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml index 1739f731dd..7d0b6cd5f4 100644 --- a/language/oop5/magic.xml +++ b/language/oop5/magic.xml @@ -1,6 +1,6 @@ - + @@ -29,10 +29,10 @@ __set(), __isset(), __unset(), - __sleep(), - __wakeup(), __serialize(), __unserialize(), + __sleep(), + __wakeup(), __toString(), __invoke(), __set_state(), @@ -71,104 +71,6 @@ - - - <link linkend="object.sleep">__sleep()</link> と - <link linkend="object.wakeup">__wakeup()</link> - - - - public array__sleep - - - - public void__wakeup - - - - - serialize は、クラスに特殊な名前 - __sleep() の関数があるかどうかを調べます。 - もしあれば、シリアル化の前にその関数を実行します。 - この関数で、オブジェクトをクリアすることができます。 - またこの関数は、シリアル化するオブジェクトについて、 - すべての変数の名前を配列で返すことが前提となっています。 - このメソッドが何も返さなかった場合は、&null; - がシリアル化され、E_NOTICE が発生します。 - - - - __sleep() で、親クラスの private - プロパティの名前を返すことはできません。 - そうしようとすると E_NOTICE レベルのエラーとなります。 - この場合は、__serialize() を代わりに使って下さい。 - - - - - PHP 8.0.0 以降では、 - __sleep() から配列でない値を返すと、 - E_WARNING が発生するようになりました。これより前のバージョンでは、 - E_NOTICE が発生していました。 - - - - 典型的な __sleep() の使用法は、 - 途中のデータをコミットしたり、 - 似たようなタスクのクリアを行うといったものです。 - また、オブジェクトが非常に大きく、かつ、完全に保存する必要がない場合、 - この関数が有用です。 - - - 逆に、unserialize は、 - 特殊な名前 __wakeup() を有する - 関数の存在を調べます。 - もし存在する場合、この関数は、オブジェクトが有する可能性が - あるあらゆるリソースを再構築することができます。 - - - __wakeup() の使用目的は、 - シリアル化の際に失われたデータベース接続を再度確立したり、 - その他の再初期化を行うことです。 - - - sleep と wakeup - -dsn = $dsn; - $this->username = $username; - $this->password = $password; - $this->connect(); - } - - private function connect() - { - $this->link = new PDO($this->dsn, $this->username, $this->password); - } - - public function __sleep() - { - return array('dsn', 'username', 'password'); - } - - public function __wakeup() - { - $this->connect(); - } -}?> -]]> - - - - <link linkend="object.serialize">__serialize()</link> と @@ -273,6 +175,114 @@ class Connection </example> </sect2> + <sect2 xml:id="language.oop5.magic.sleep"> + <title> + <link linkend="object.sleep">__sleep()</link> と + <link linkend="object.wakeup">__wakeup()</link> + + + + + このシリアル化の仕組みは、PHP 8.5.0 以降 soft-deprecated 扱いになりました。 + 後方互換性のために維持されていますが、新規コードおよび既存コードは、代わりに + __serialize() と + __unserialize() + マジックメソッドを使うように移行すべきです。 + + + + + public array__sleep + + + + public void__wakeup + + + + + serialize は、クラスに特殊な名前 + __sleep() の関数があるかどうかを調べます。 + もしあれば、シリアル化の前にその関数を実行します。 + この関数で、オブジェクトをクリアすることができます。 + またこの関数は、シリアル化するオブジェクトについて、 + すべての変数の名前を配列で返すことが前提となっています。 + このメソッドが何も返さなかった場合は、&null; + がシリアル化され、E_NOTICE が発生します。 + + + + __sleep() で、親クラスの private + プロパティの名前を返すことはできません。 + そうしようとすると E_NOTICE レベルのエラーとなります。 + この場合は、__serialize() を代わりに使って下さい。 + + + + + PHP 8.0.0 以降では、 + __sleep() から配列でない値を返すと、 + E_WARNING が発生するようになりました。これより前のバージョンでは、 + E_NOTICE が発生していました。 + + + + 典型的な __sleep() の使用法は、 + 途中のデータをコミットしたり、 + 似たようなタスクのクリアを行うといったものです。 + また、オブジェクトが非常に大きく、かつ、完全に保存する必要がない場合、 + この関数が有用です。 + + + 逆に、unserialize は、 + 特殊な名前 __wakeup() を有する + 関数の存在を調べます。 + もし存在する場合、この関数は、オブジェクトが有する可能性が + あるあらゆるリソースを再構築することができます。 + + + __wakeup() の使用目的は、 + シリアル化の際に失われたデータベース接続を再度確立したり、 + その他の再初期化を行うことです。 + + + sleep と wakeup + +dsn = $dsn; + $this->username = $username; + $this->password = $password; + $this->connect(); + } + + private function connect() + { + $this->link = new PDO($this->dsn, $this->username, $this->password); + } + + public function __sleep() + { + return array('dsn', 'username', 'password'); + } + + public function __wakeup() + { + $this->connect(); + } +}?> +]]> + + + + <link linkend="object.tostring">__toString()</link> diff --git a/reference/array/functions/array-rand.xml b/reference/array/functions/array-rand.xml index 37731a7692..f3d4a3e8c1 100644 --- a/reference/array/functions/array-rand.xml +++ b/reference/array/functions/array-rand.xml @@ -1,6 +1,6 @@ - + @@ -19,6 +19,7 @@ 取り出したエントリのキーを返します。 &caution.cryptographically-insecure; + &caution.mt19937-global-state; &reftitle.parameters; diff --git a/reference/array/functions/shuffle.xml b/reference/array/functions/shuffle.xml index 790a1c84e3..74194db86c 100644 --- a/reference/array/functions/shuffle.xml +++ b/reference/array/functions/shuffle.xml @@ -1,6 +1,6 @@ - + @@ -17,6 +17,7 @@ この関数は、配列をシャッフル (要素の順番をランダムに) します。 &caution.cryptographically-insecure; + &caution.mt19937-global-state; &reftitle.parameters; diff --git a/reference/datetime/datetimeinterface.xml b/reference/datetime/datetimeinterface.xml index e6ab13d3e8..1958926cbc 100644 --- a/reference/datetime/datetimeinterface.xml +++ b/reference/datetime/datetimeinterface.xml @@ -1,6 +1,6 @@ - + @@ -158,7 +158,7 @@ DATE_ATOM - Atom (例: 2005-08-15T15:52:01+00:00)。ISO-8601、RFC 3399、および XML Schema と互換性があります + Atom (例: 2005-08-15T15:52:01+00:00)。ISO-8601、RFC 3339、および XML Schema と互換性があります diff --git a/reference/intl/intltimezone/createenumeration.xml b/reference/intl/intltimezone/createenumeration.xml index b1f814c1a2..0a830b113e 100644 --- a/reference/intl/intltimezone/createenumeration.xml +++ b/reference/intl/intltimezone/createenumeration.xml @@ -1,6 +1,6 @@ - + @@ -14,12 +14,12 @@ &style.oop; (method): public static IntlIteratorfalseIntlTimeZone::createEnumeration - IntlTimeZonestringintfloatnullcountryOrRawOffset&null; + stringintnullcountryOrRawOffset&null; &style.procedural;: IntlIteratorfalseintltz_create_enumeration - IntlTimeZonestringintfloatnullcountryOrRawOffset&null; + stringintnullcountryOrRawOffset&null; diff --git a/reference/intl/numberformatter/set-attribute.xml b/reference/intl/numberformatter/set-attribute.xml index e86b3e2b73..19e14a38a8 100644 --- a/reference/intl/numberformatter/set-attribute.xml +++ b/reference/intl/numberformatter/set-attribute.xml @@ -1,6 +1,6 @@ - + NumberFormatter::setAttribute @@ -116,6 +116,45 @@ Digits: 2 1.234.567,89 ]]> + + <constant>NumberFormatter::ROUNDING_MODE</constant> を使って値を切り捨てる + + デフォルトでは、NumberFormatter は値を丸めます。 + NumberFormatter::ROUNDING_MODE に + NumberFormatter::ROUND_DOWN を設定すると、 + 丸め処理を行わず、指定した小数桁数で値を切り捨てます。 + + +setAttribute(NumberFormatter::FRACTION_DIGITS, 2); + +echo "Default rounding mode:\n"; +echo $fmt->format(3.789), "\n"; // 3.79 (rounded up) +echo $fmt->format(3.781), "\n"; // 3.78 (rounded down) + +$fmt->setAttribute(NumberFormatter::ROUNDING_MODE, NumberFormatter::ROUND_DOWN); + +echo "\nWith ROUND_DOWN (truncate):\n"; +echo $fmt->format(3.789), "\n"; // 3.78 (truncated) +echo $fmt->format(3.781), "\n"; // 3.78 (truncated) +?> +]]> + + &example.outputs; + + + + diff --git a/reference/intl/resourcebundle/get.xml b/reference/intl/resourcebundle/get.xml index 9c3e9d85c6..924d8fbed4 100644 --- a/reference/intl/resourcebundle/get.xml +++ b/reference/intl/resourcebundle/get.xml @@ -1,6 +1,6 @@ - + @@ -15,7 +15,7 @@ &style.oop; - public mixedResourceBundle::get + public ResourceBundlearraystringintnullResourceBundle::get stringintindex boolfallback&true; @@ -23,7 +23,7 @@ &style.procedural; - mixedresourcebundle_get + ResourceBundlearraystringintnullresourcebundle_get ResourceBundlebundle stringintindex boolfallback&true; diff --git a/reference/intl/transliterator/geterrorcode.xml b/reference/intl/transliterator/geterrorcode.xml index 7fedaf0075..16cb6ed9db 100644 --- a/reference/intl/transliterator/geterrorcode.xml +++ b/reference/intl/transliterator/geterrorcode.xml @@ -1,6 +1,6 @@ - + @@ -14,12 +14,12 @@ &reftitle.description; &style.oop; - public intfalseTransliterator::getErrorCode + public intTransliterator::getErrorCode &style.procedural; - intfalsetransliterator_get_error_code + inttransliterator_get_error_code Transliteratortransliterator diff --git a/reference/intl/transliterator/geterrormessage.xml b/reference/intl/transliterator/geterrormessage.xml index f783f65043..79d382dab2 100644 --- a/reference/intl/transliterator/geterrormessage.xml +++ b/reference/intl/transliterator/geterrormessage.xml @@ -1,6 +1,6 @@ - + @@ -14,12 +14,12 @@ &reftitle.description; &style.oop; - public stringfalseTransliterator::getErrorMessage + public stringTransliterator::getErrorMessage &style.procedural; - stringfalsetransliterator_get_error_message + stringtransliterator_get_error_message Transliteratortransliterator diff --git a/reference/pcre/functions/preg-replace.xml b/reference/pcre/functions/preg-replace.xml index 7e04f19592..deb49bf5af 100644 --- a/reference/pcre/functions/preg-replace.xml +++ b/reference/pcre/functions/preg-replace.xml @@ -1,6 +1,6 @@ - + @@ -86,17 +86,6 @@ こうすることで、1 はリテラルとなり、後方参照 $1 を明確に作成できます。 - - 非推奨の e 修飾子を使用する際に、 - この関数は後方参照を置換する文字列のうちの特定の文字 - (具体的には '"、 - \ および NULL) をエスケープします。 - これは、後方参照をシングルクォートやダブルクォートを共用した場合 - (たとえば 'strlen(\'$1\')+strlen("$2")') - に構文エラーが発生しないようにするためのものです。 - PHP の 文字列構文 を意識し、 - 文字列がどのように解釈されるのかを正確に知っておくようにしましょう。 - diff --git a/reference/random/functions/mt-rand.xml b/reference/random/functions/mt-rand.xml index bdc15c39b4..fc0787ed2e 100644 --- a/reference/random/functions/mt-rand.xml +++ b/reference/random/functions/mt-rand.xml @@ -1,6 +1,6 @@ - + @@ -35,6 +35,7 @@ mt_rand(5, 15) としてください。 &caution.cryptographically-insecure; + &caution.mt19937-global-state; &reftitle.parameters; diff --git a/reference/random/functions/rand.xml b/reference/random/functions/rand.xml index c21b57d137..3bfecf2fc5 100644 --- a/reference/random/functions/rand.xml +++ b/reference/random/functions/rand.xml @@ -1,6 +1,6 @@ - + @@ -27,6 +27,7 @@ rand(5, 15) とします。 &caution.cryptographically-insecure; + &caution.mt19937-global-state; PHP 7.1.0 より前のバージョンでは、(Windows のような)いくつかのプラットフォームにおいて diff --git a/reference/spl/splfileinfo/getfilename.xml b/reference/spl/splfileinfo/getfilename.xml index b6ca90ae99..05e431ab82 100644 --- a/reference/spl/splfileinfo/getfilename.xml +++ b/reference/spl/splfileinfo/getfilename.xml @@ -1,6 +1,6 @@ - + SplFileInfo::getFilename @@ -57,8 +57,8 @@ var_dump($info->getFilename()); diff --git a/reference/stream/functions/stream-select.xml b/reference/stream/functions/stream-select.xml index 63cd406d9b..1f71b1ffd7 100644 --- a/reference/stream/functions/stream-select.xml +++ b/reference/stream/functions/stream-select.xml @@ -1,6 +1,6 @@ - + @@ -79,10 +79,10 @@ microseconds はマイクロ秒数を指定します。 timeout は、stream_select の実行から戻るまでの時間の上限です。 - seconds および microseconds - の両方に 0 を指定すると - stream_select はデータを待たずに一瞬で戻ります。 - これは現在のストリームの状態を示します。 + seconds0 を指定し、かつ + microseconds0 または &null; の場合、 + stream_select はデータを待たずにすぐに戻り、 + 現在のストリームの状態を示します。 seconds が &null; (タイムアウトなし) の場合、 diff --git a/reference/strings/functions/str-shuffle.xml b/reference/strings/functions/str-shuffle.xml index 8da88bb35a..99cdf30070 100644 --- a/reference/strings/functions/str-shuffle.xml +++ b/reference/strings/functions/str-shuffle.xml @@ -1,6 +1,6 @@ - + @@ -19,6 +19,7 @@ 考えられるすべての順列のうちのひとつを作成します。 &caution.cryptographically-insecure; + &caution.mt19937-global-state; diff --git a/security/sessions.xml b/security/sessions.xml index c54b9bd051..4375826a35 100644 --- a/security/sessions.xml +++ b/security/sessions.xml @@ -1,13 +1,13 @@ - + セッションのセキュリティ - HTTPセッション管理を安全にし続けることは重要です。 + HTTPセッション管理のセキュリティを保つことは重要です。 セッション関連のセキュリティについては セッションのセキュリティ セクション (セッションモジュール リファレンス内)