Skip to content

Commit 2d5c271

Browse files
authored
[PHP 8.4] fix php/doc-en#4063 (PHP 8.4: trigger_error() updates) (#191)
* [WIP] work on php/doc-en#4063 * #191 Insert original content ref: php/doc-en@72b70d7 * #191 Translate * #194 Fix element position
1 parent 722af66 commit 2d5c271

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

reference/errorfunc/functions/trigger-error.xml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 210d382b5b139444fe2e16a5a3211076a65ff2ba Maintainer: hirokawa Status: ready -->
3+
<!-- EN-Revision: 72b70d7c3c3b2b87423641906da2db407c32c3c3 Maintainer: hirokawa Status: ready -->
44
<!-- CREDITS: takagi -->
55
<refentry xml:id="function.trigger-error" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -42,6 +42,14 @@
4242
<para>
4343
このエラーに割り当てられたエラー型です。<constant>E_USER_<replaceable>*</replaceable></constant> の定数のみが指定可能で、デフォルトは <constant>E_USER_NOTICE</constant> です。
4444
</para>
45+
<warning>
46+
<simpara>
47+
<parameter>error_level</parameter> として
48+
<constant>E_USER_ERROR</constant> を指定するのは非推奨となりました。
49+
かわりに、<exceptionname>Exception</exceptionname> をスローするか、
50+
<function>exit</function> を呼び出してください。
51+
</simpara>
52+
</warning>
4553
</listitem>
4654
</varlistentry>
4755
</variablelist>
@@ -77,6 +85,22 @@
7785
</row>
7886
</thead>
7987
<tbody>
88+
<row>
89+
<entry>8.4.0</entry>
90+
<entry>
91+
<parameter>error_level</parameter> として
92+
<constant>E_USER_ERROR</constant> を指定するのは非推奨となりました。
93+
かわりに、<exceptionname>Exception</exceptionname> をスローするか、
94+
<function>exit</function> を呼び出してください。
95+
</entry>
96+
</row>
97+
<row>
98+
<entry>8.4.0</entry>
99+
<entry>
100+
戻り値の型が、<type>bool</type> ではなく
101+
<type>true</type> に変更されました。
102+
</entry>
103+
</row>
80104
<row>
81105
<entry>8.0.0</entry>
82106
<entry>
@@ -102,9 +126,11 @@
102126
<programlisting role="php">
103127
<![CDATA[
104128
<?php
105-
if ($divisor == 0) {
106-
trigger_error("ゼロで割ることはできません", E_USER_ERROR);
129+
$password = $_POST['password'] ?? '';
130+
if ($password === '') {
131+
trigger_error("空のパスワードを使用することは安全ではありません", E_USER_WARNING);
107132
}
133+
$hash = password_hash($password, PASSWORD_DEFAULT);
108134
?>
109135
]]>
110136
</programlisting>
@@ -129,6 +155,7 @@ if ($divisor == 0) {
129155
<member><function>set_error_handler</function></member>
130156
<member><function>restore_error_handler</function></member>
131157
<member><link linkend="errorfunc.constants">エラーレベル定数</link></member>
158+
<member><classname>Deprecated</classname> アトリビュート</member>
132159
</simplelist>
133160
</para>
134161
</refsect1>

0 commit comments

Comments
 (0)