Skip to content

Commit

Permalink
Update appendices
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Nov 8, 2023
1 parent d8c795e commit ef18f81
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 291 deletions.
54 changes: 19 additions & 35 deletions appendices/migration71/changed-functions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: ef9b464ad778b0e470d536c1e4a2a011f203e165 Maintainer: yuanyuqiang Status: ready -->
<!-- Reviewed: no -->

<sect1 xml:id="migration71.changed-functions">
<title>变动的函数</title>

Expand All @@ -16,22 +14,17 @@
<itemizedlist>
<listitem>
<simpara>
<function>getopt</function> 函数增加了第三个参数,这是一个可选参数。
通过以引用的方式传入参数,
它可以用来存储参数列表中下一个参数的下标位置。
<function>getopt</function> 函数增加了第三个参数,这是一个可选参数。通过以引用的方式传入参数,它可以用来存储参数列表中下一个参数的下标位置。
</simpara>
</listitem>
<listitem>
<simpara>
<function>getenv</function> 可以不传入任何参数。
如果不传入参数,此函数会以关联数组的形式
返回所有的环境变量。
<function>getenv</function> 可以不传入任何参数。如果不传入参数,此函数会以关联数组的形式返回所有的环境变量。
</simpara>
</listitem>
<listitem>
<simpara>
<function>get_headers</function> 增加了一个参数,
可以用来解析自定义的流上下文。
<function>get_headers</function> 增加了一个参数,可以用来解析自定义的流上下文。
</simpara>
</listitem>
<listitem>
Expand All @@ -42,14 +35,12 @@
</listitem>
<listitem>
<simpara>
<function>parse_url</function> 更加严格的限制,
并且提供对 RFC3986 的支持。
<function>parse_url</function> 更加严格的限制,并且提供对 RFC3986 的支持。
</simpara>
</listitem>
<listitem>
<simpara>
<function>unpack</function> 函数增加第三个参数,
这是一个可选参数,用来指定开始解包的位置。
<function>unpack</function> 函数增加第三个参数,这是一个可选参数,用来指定开始解包的位置。
</simpara>
</listitem>
</itemizedlist>
Expand All @@ -60,8 +51,7 @@
<itemizedlist>
<listitem>
<simpara>
<function>file_get_contents</function> 接受负数作为搜索偏移量,
前提是流上下文必须是可搜索的。
<function>file_get_contents</function> 接受负数作为搜索偏移量,前提是流上下文必须是可搜索的。
</simpara>
</listitem>
<listitem>
Expand All @@ -78,10 +68,9 @@
<itemizedlist>
<listitem>
<simpara>
<function>json_encode</function> 增加新的选项:
<constant>JSON_UNESCAPED_LINE_TERMINATORS</constant>。
这个选项可以在指定 <constant>JSON_UNESCAPED_UNICODE</constant> 选项的时候,
对于 U+2028 和 U+2029 这两个字符不再进行转义。
<function>json_encode</function> 增加新的选项
<constant>JSON_UNESCAPED_LINE_TERMINATORS</constant>。这个选项可以在指定 <constant>JSON_UNESCAPED_UNICODE</constant>
选项的时候,对于 U+2028 和 U+2029 这两个字符不再进行转义。
</simpara>
</listitem>
</itemizedlist>
Expand All @@ -108,9 +97,8 @@
<itemizedlist>
<listitem>
<simpara>
<methodname>PDO::lastInsertId</methodname> 在用于 PostgreSQL 数据库的时候,
如果当前会话(到 PostgreSQL 的数据库连接)上尚未调用过 <literal>nextval</literal>,
那么此方法会触发一个错误。
<methodname>PDO::lastInsertId</methodname> 在用于 PostgreSQL 数据库的时候,如果当前会话(到 PostgreSQL
的数据库连接)上尚未调用过 <literal>nextval</literal>,那么此方法会触发一个错误。
</simpara>
</listitem>
</itemizedlist>
Expand All @@ -121,24 +109,21 @@
<itemizedlist>
<listitem>
<simpara>
<function>pg_last_notice</function> 增加一个用来指定操作的可选参数。
可使用以下常量作为此参数的值: <constant>PGSQL_NOTICE_LAST</constant>,
<constant>PGSQL_NOTICE_ALL</constant> 或
<function>pg_last_notice</function> 增加一个用来指定操作的可选参数。可使用以下常量作为此参数的值
<constant>PGSQL_NOTICE_LAST</constant>、<constant>PGSQL_NOTICE_ALL</constant> 或
<constant>PGSQL_NOTICE_CLEAR</constant>。
</simpara>
</listitem>
<listitem>
<simpara>
<function>pg_fetch_all</function> 增加第二个参数,这是一个可选参数,
它用来指定返回结果的类型
(类似于 <function>pg_fetch_array</function> 的第三个参数)。
<function>pg_fetch_all</function> 增加第二个参数,这是一个可选参数,它用来指定返回结果的类型(类似于
<function>pg_fetch_array</function> 的第三个参数)。
</simpara>
</listitem>
<listitem>
<simpara>
<function>pg_select</function> 增加第四个参数,这是一个可选参数,
它用来指定返回结果的类型
(类似于 <function>pg_fetch_array</function> 的第三个参数)。
<function>pg_select</function> 增加第四个参数,这是一个可选参数,它用来指定返回结果的类型(类似于
<function>pg_fetch_array</function> 的第三个参数)。
</simpara>
</listitem>
</itemizedlist>
Expand All @@ -149,9 +134,8 @@
<itemizedlist>
<listitem>
<simpara>
<function>session_start</function> 当无法成功初始化会话的时候,返回 &false;
并且不会初始化超级变量
<varname>$_SESSION</varname>。
<function>session_start</function> 当无法成功初始化会话的时候,返回 &false;,并且不会初始化超级变量
<varname>$_SESSION</varname>。
</simpara>
</listitem>
</itemizedlist>
Expand Down
2 changes: 0 additions & 2 deletions appendices/migration71/constants.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 561d3b82afe96cad44bec890b4641ce177716142 Maintainer: jhdxr Status: ready -->
<!-- Reviewed: no -->

<sect1 xml:id="migration71.constants" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>新增的全局常量</title>

Expand Down
11 changes: 4 additions & 7 deletions appendices/migration71/deprecated.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 7583c04ddc22338056e87ca972d6b7221af86422 Maintainer: jhdxr Status: ready -->
<!-- Reviewed: no -->

<sect1 xml:id="migration71.deprecated">
<title>PHP 7.1.x 中废弃的特性</title>

<sect2 xml:id="migration71.deprecated.ext-mcrypt">
<title>ext/mcrypt</title>

<para>
mcrypt 扩展已经过时了大约10年,并且用起来很复杂。因此它被废弃并且被 OpenSSL 所取代。
从PHP 7.2起它将被从核心代码中移除并且移到PECL中。
mcrypt 扩展已经过时了大约 10 年,并且用起来很复杂。因此它被废弃并且被 OpenSSL 所取代。从 PHP 7.2 起它将被从核心代码中移除并且移到 PECL 中。
</para>
</sect2>

<sect2 xml:id="migration71.deprecated.eval-option-for-mb-ereg-replace">
<title><function>mb_ereg_replace</function><function>mb_eregi_replace</function>的Eval选项</title>
<title><function>mb_ereg_replace</function><function>mb_eregi_replace</function> 的 Eval 选项</title>

<para>
对于<function>mb_ereg_replace</function><function>mb_eregi_replace</function>的
<literal>e</literal>模式修饰符现在已被废弃。
对于 <function>mb_ereg_replace</function><function>mb_eregi_replace</function>
<literal>e</literal> 模式修饰符现在已被废弃。
</para>
</sect2>
</sect1>
Expand Down
44 changes: 18 additions & 26 deletions appendices/migration71/incompatible.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 19e8122137a1d42ed60f17fe2c0c2b69b0b2d16b Maintainer: jhdxr Status: partial -->
<!-- EN-Revision: 19e8122137a1d42ed60f17fe2c0c2b69b0b2d16b Maintainer: jhdxr Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<sect1 xml:id="migration71.incompatible">
<title>不向后兼容的变更</title>
Expand All @@ -9,9 +9,8 @@
<title>当传递参数过少时将抛出错误</title>

<para>
在过去如果我们调用一个用户定义的函数时,提供的参数不足,那么将会产生一个警告(warning)。
现在,这个警告被提升为一个错误异常(Error exception)。这个变更仅对用户定义的函数生效,
并不包含内置函数。例如:
在过去如果我们调用一个用户定义的函数时,提供的参数不足,那么将会产生警告(warning)。现在,这个警告被提升为错误异常(Error
exception)。这个变更仅对用户定义的函数生效,并不包含内置函数。例如:
</para>

<informalexample>
Expand Down Expand Up @@ -156,25 +155,21 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d
</sect2>

<sect2 xml:id="migration71.incompatible.delete-control-character-in-identifiers">
<title>Disallow the ASCII delete control character in identifiers</title>
<title>禁止在标识符中使用 ASCII 删除控制字符</title>

<para>
The ASCII delete control character (<literal>0x7F</literal>) can no longer
be used in identifiers that are not quoted.
ASCII 删除控制字符(<literal>0x7F</literal>)不能用于未加引号的标识符中。
</para>
</sect2>

<sect2 xml:id="migration71.incompatible.error_log-syslog">
<title>
<parameter>error_log</parameter> changes with <literal>syslog</literal>
value
<parameter>error_log</parameter> 更改为 <literal>syslog</literal> 值
</title>

<para>
如果 <parameter>error_log</parameter> ini 设置为 <literal>syslog</literal>,PHP 错误等级会映射到 syslog 错误级别。
This brings finer differentiation in the error logs in
contrary to the previous approach where all the errors are logged with the
notice level only.
如果 <parameter>error_log</parameter> ini 设置为 <literal>syslog</literal>,PHP 错误等级会映射到 syslog
错误级别。这在错误日志中带来了更好的区分,与之前相反,之前所有的错误只记录了错误级别。
</para>
</sect2>

Expand All @@ -195,8 +190,8 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d
<function>call_user_func</function> 现在在调用一个以引用作为参数的函数时将始终产生一个警告。先前这取决于这个调用行为是否完全符合条件。
</para>
<para>
此外, <function>call_user_func</function> 和
<function>call_user_func_array</function> 在这种情况下将不再中断函数调用。现在会出现一个包含"expected reference"的警告信息,但函数调用将正常进行。
此外,<function>call_user_func</function> 和
<function>call_user_func_array</function> 在这种情况下将不再中断函数调用。现在会出现包含“expected reference的警告信息,但函数调用将正常进行。
</para>
</sect2>

Expand All @@ -206,16 +201,15 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d
</title>

<para>
对字符串使用一个空索引操作符(例如<literal>$str[] = $x</literal>)将会抛出一个致命错误,
而不是静默地将其转为一个数组。
对字符串使用一个空索引操作符(例如<literal>$str[] = $x</literal>)将会抛出一个致命错误,而不是静默地将其转为一个数组。
</para>
</sect2>

<sect2 xml:id="migration71.incompatible.removed-ini-directives">
<title>ini配置项移除</title>
<title>ini 配置项移除</title>

<para>
下列ini配置项已经被移除
下列 ini 配置项已经被移除
</para>

<itemizedlist>
Expand Down Expand Up @@ -421,11 +415,11 @@ new DateTime() == new DateTime();
</sect2>

<sect2 xml:id="migration71.incompatible.lexical-names">
<title>Lexically bound variables cannot reuse names</title>
<title>词法绑定变量不能重用名字</title>

<para>
通过 <literal>use</literal> 构造绑定到 <link linkend="functions.anonymous">closure</link>
的变量不能使用与任何 &link.superglobals;、<varname>$this</varname> 或任何参数相同的名称。 例如,所有这些函数定义都会导致致命错误:
的变量不能使用与任何 &link.superglobals;、<varname>$this</varname> 或任何参数相同的名称。例如,所有这些函数定义都会导致致命错误:
<informalexample>
<programlisting role="php">
<![CDATA[
Expand Down Expand Up @@ -494,12 +488,10 @@ object(stdClass)#1 (1) {
</sect2>

<sect2 xml:id="migration71.incompatible.typed-returns-compile-time">
<title>Forbid "return;" for typed returns already at compile-time</title>
<title>在编译时禁止 "return;" 用于类型化返回</title>
<para>
Return statements without argument in functions which declare a return type
now trigger <constant>E_COMPILE_ERROR</constant> (unless the return type is
declared as <type>void</type>), even if the return statement would never be
reached.
在声明返回类型的函数中,没有参数的 return 语句现在触发 <constant>E_COMPILE_ERROR</constant>(除非返回类型声明为
<type>void</type>),即使永远不会到达 return 语句。
</para>
</sect2>

Expand Down
6 changes: 2 additions & 4 deletions appendices/migration80.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@

<sect1 annotations="chunk:false" xml:id="migration80.intro">
<para>
新的主版本号带来了一些
<link linkend="migration80.new-features">新特性</link> 和
<link linkend="migration80.incompatible">不兼容处</link>,
在生产环境上切换 PHP 版本前需要做测试。
新的主版本号带来了一些<link linkend="migration80.new-features">新特性</link>和<link
linkend="migration80.incompatible">不兼容处</link>,在生产环境上切换 PHP 版本前需要做测试。
</para>

<para>
Expand Down
Loading

0 comments on commit ef18f81

Please sign in to comment.