Skip to content

Commit

Permalink
Update appendices
Browse files Browse the repository at this point in the history
  • Loading branch information
mowangjuanzi committed Nov 2, 2023
1 parent c68e95b commit 91ea1b1
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 210 deletions.
6 changes: 2 additions & 4 deletions appendices/migration73.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

<sect1 annotations="chunk:false" xml:id="migration73.intro">
<para>
这个新的小版本带来了大量的
<link linkend="migration73.new-features">新特性</link>和
<link linkend="migration73.incompatible">少量的兼容性调整</link>
在生产环境切换 PHP 版本前应该进行相关测试。
这个新的小版本带来了大量的<link linkend="migration73.new-features">新特性</link>和<link
linkend="migration73.incompatible">少量的兼容性调整</link>在生产环境切换 PHP 版本前应该进行相关测试。
</para>

<para>
Expand Down
13 changes: 6 additions & 7 deletions appendices/migration73/constants.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 7034bb7f23a02d76f0f55a34b25f5e73edf86569 Maintainer: jhdxr Status: ready -->
<!-- Reviewed: no -->

<!-- CREDITS: mowangjuanzi -->
<sect1 xml:id="migration73.constants" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>新的全局常量</title>

Expand All @@ -17,7 +16,7 @@
</sect2>

<sect2 xml:id="migration73.constants.curl">
<title>Client URL Library</title>
<title>客户端 URL </title>

<itemizedlist>
<listitem>
Expand Down Expand Up @@ -270,7 +269,7 @@
</sect2>

<sect2 xml:id="migration73.constants.filter">
<title>Data Filtering</title>
<title>数据过滤</title>

<itemizedlist>
<listitem>
Expand All @@ -280,7 +279,7 @@
</sect2>

<sect2 xml:id="migration73.constants.json">
<title>JavaScript Object Notation</title>
<title>JavaScript 对象表示法</title>

<itemizedlist>
<listitem>
Expand All @@ -290,7 +289,7 @@
</sect2>

<sect2 xml:id="migration73.constants.ldap">
<title>Lightweight Directory Access Protocol</title>
<title>轻量目录访问协议</title>

<itemizedlist>
<listitem>
Expand Down Expand Up @@ -375,7 +374,7 @@
</sect2>

<sect2 xml:id="migration73.constants.mbstring">
<title>Multibyte String</title>
<title>多字节字符串</title>

<itemizedlist>
<listitem>
Expand Down
141 changes: 49 additions & 92 deletions appendices/migration73/incompatible.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 86e6094e86b84a51d00ab217ac50ce8dde33d82a Maintainer: avenger Status: partial -->
<!-- Reviewed: no -->

<!-- CREDITS: mowangjuanzi -->
<sect1 xml:id="migration73.incompatible" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>不向下兼容的变更</title>

<sect2 xml:id="migration73.incompatible.core">
<title>PHP 核心</title>

<sect3 xml:id="migration73.incompatible.core.heredoc-nowdoc">
<title>Heredoc/Nowdoc Ending Label Interpretation</title>
<title>Heredoc/Nowdoc 结束标签解释</title>

<para>
Due to the introduction of <link
linkend="migration73.new-features.core.heredoc">flexible heredoc/nowdoc
syntax</link>, doc strings that contain the ending label inside their body
may cause syntax errors or change in interpretation. For example in:
由于引入了<link linkend="migration73.new-features.core.heredoc">灵活的 heredoc/nowdoc
语法</link>,正文中包含结束标签的文档字符串可能会导致语法错误或解释发生变化。例如在:
<informalexample>
<programlisting role="php">
<![CDATA[
Expand All @@ -29,23 +26,17 @@ FOO;
]]>
</programlisting>
</informalexample>
the indented occurrence of <literal>FOO</literal> did not previously have any
special meaning. Now it will be interpreted as the end of the heredoc string
and the following <literal>FOO;</literal> will cause a syntax error. This issue can
always be resolved by choosing an ending label that does not occur within the
contents of the string.
<literal>FOO</literal> 缩进在出现之前没有任何特殊含义。现在将解释为 heredoc 字符串的结尾,并且之后的 <literal>FOO;</literal>
将导致语法错误。这个问题始终可以通过选择一个不在字符串内容中出现的结束标签来解决。
</para>
</sect3>

<sect3 xml:id="migration73.incompatible.core.continue-targeting-switch">
<title>Continue Targeting Switch issues Warning</title>
<title>Switch 中使用 Continue 会发出警告</title>

<para>
<literal>continue</literal> statements targeting <literal>switch</literal>
control flow structures will now generate a warning. In PHP such
<literal>continue</literal> statements are equivalent to
<literal>break</literal>, while they behave as <literal>continue 2</literal>
in other languages.
<literal>switch</literal> 控制流结构使用 <literal>continue</literal> 语句现在将生成警告。在 PHP 中,<literal>continue</literal> 语句相当于
<literal>break</literal>,而在其它语言中它们的行为等同于 <literal>continue 2</literal>。
<informalexample>
<programlisting role="php">
<![CDATA[
Expand Down Expand Up @@ -160,58 +151,47 @@ foo(...gen());
</sect3>

<sect3 xml:id="migration73.incompatible.core.misc">
<title>Miscellaneous</title>
<title>杂项</title>

<para>
The <filename>ext_skel</filename> utility has been completely redesigned with
new options and some old options removed. This is now written in PHP and has
no external dependencies.
<filename>ext_skel</filename> 应用程序已重新设计,添加了一些新选项并删除了一些旧选项。现在是用 PHP 编写的,没有外部依赖项。
</para>

<para>
Support for BeOS has been dropped.
已弃用对 BeOS 的支持。
</para>

<para>
Exceptions thrown due to automatic conversion of warnings into exceptions in
<literal>EH_THROW</literal> mode (e.g. some <classname>DateTime</classname>
exceptions) no longer populate <function>error_get_last</function> state. As
such, they now work the same way as manually thrown exceptions.
由于在 <literal>EH_THROW</literal> 模式下将警告自动转换为异常而引发的异常(例如某些 <classname>DateTime</classname>
异常)将不再填充 <function>error_get_last</function> 状态。因此,它们现在的工作方式与手动引发异常相同。
</para>

<para>
<classname>TypeError</classname> now reports wrong types as
<literal>int</literal> and <literal>bool</literal> instead of
<literal>integer</literal> and <literal>boolean</literal>, respectively.
<classname>TypeError</classname> 现在将错误类型分别报告为 <literal>int</literal> 和
<literal>bool</literal>,而不是 <literal>integer</literal> 和 <literal>boolean</literal>。
</para>

<para>
Undefined variables passed to <function>compact</function> will now be
reported as a notice.
未定义变量传递给 <function>compact</function>,现在将报告为 notice。
</para>

<para>
<function>getimagesize</function> and related functions now report the mime
type of BMP images as <literal>image/bmp</literal> instead of
<literal>image/x-ms-bmp</literal>, since the former has been registered with
the IANA (see <link xlink:href="&url.rfc;7903">RFC 7903</link>).
<function>getimagesize</function> 和相关函数现在将 BMP 图像的 mime 类型报告为 <literal>image/bmp</literal> 而不是
<literal>image/x-ms-bmp</literal>,因为前者已经在 IANA 注册(参阅 <link xlink:href="&url.rfc;7903">RFC 7903</link>)。
</para>

<para>
<function>stream_socket_get_name</function> will now return IPv6 addresses
wrapped in brackets. For example <literal>"[::1]:1337"</literal> will be
returned instead of <literal>"::1:1337"</literal>.
<function>stream_socket_get_name</function> 现在将返回由中括号括起来的 IPv6 地址。例如,将返回
<literal>"[::1]:1337"</literal> 而不是 <literal>"::1:1337"</literal>。
</para>
</sect3>
</sect2>

<sect2 xml:id="migration73.incompatible.bc">
<title>BCMath Arbitrary Precision Mathematics</title>
<title>BCMath 任意精度数学</title>

<para>
All warnings thrown by <link linkend="ref.bc">BCMath functions</link> are
now using PHP's error handling. Formerly some warnings have directly been
written to stderr.
<link linkend="ref.bc">BCMath 函数</link>抛出的所有警告现在都使用 PHP 的错误处理。以前,一些警告直接写入了 stderr。
</para>

<para>
Expand All @@ -222,100 +202,77 @@ foo(...gen());
</sect2>

<sect2 xml:id="migration73.incompatible.imap">
<title>IMAP, POP3 and NNTP</title>
<title>IMAPPOP3 NNTP</title>

<para>
<command>rsh</command>/<command>ssh</command> logins are disabled by default.
Use <link
linkend="ini.imap.enable-insecure-rsh">imap.enable_insecure_rsh</link> if you
want to enable them. Note that the IMAP library does not filter mailbox names
before passing them to the <command>rsh</command>/<command>ssh</command>
command, thus passing untrusted data to this function with
<command>rsh</command>/<command>ssh</command> enabled is insecure.
默认情况下禁用 <command>rsh</command>/<command>ssh</command> 登录。使用 <link linkend="ini.imap.enable-insecure-rsh">imap.enable_insecure_rsh</link>
启用它们。请注意,将邮箱名称传递给 <command>rsh</command>/<command>ssh</command> 命令之前,IMAP 库不会对其进行过滤,因此在启用
<command>rsh</command>/<command>ssh</command> 的情况下将不受信任的数据传递给该函数是不安全的。
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.mbstring">
<title>Multibyte String</title>
<title>多字节字符串</title>

<para>
Due to added support for named captures, <literal>mb_ereg_*()</literal>
patterns using named captures will behave differently. In particular named
captures will be part of matches and <function>mb_ereg_replace</function>
will interpret additional syntax. See <link
linkend="migration73.new-features.mbstring.named-captures">Named
Captures</link> for more information.
由于增加了对命名捕获的支持,使用命名捕获的 <literal>mb_ereg_*()</literal> 模式的行为会有所不同。特别是命名捕获将成为匹配的一部分,并且
<function>mb_ereg_replace</function> 将说明额外语法。有关详细信息,请参阅<link
linkend="migration73.new-features.mbstring.named-captures">命名捕获</link>。
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.mysqli">
<title>MySQL Improved Extension</title>
<title>MySQL 扩展提升</title>

<para>
Prepared statements now properly report the fractional seconds for
<literal>DATETIME</literal>, <literal>TIME</literal> and
<literal>TIMESTAMP</literal> columns with decimals specifier (e.g.
<literal>TIMESTAMP(6)</literal> when using microseconds). Formerly, the
fractional seconds part was simply omitted from the returned values.
预处理语句现在可以正确报告带有小数位数说明符的 <literal>DATETIME</literal>、<literal>TIME</literal> 和 <literal>TIMESTAMP</literal>
列的带小数的秒(例如,使用微秒时为 <literal>TIMESTAMP(6)</literal>)。以前,返回值中简单地省略了秒的小数部分。
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.pdo-mysql">
<title>MySQL Functions (PDO_MYSQL)</title>
<title>MySQL 函数(PDO_MYSQL</title>

<para>
Prepared statements now properly report the fractional seconds for
<literal>DATETIME</literal>, <literal>TIME</literal> and
<literal>TIMESTAMP</literal> columns with decimals specifier (e.g.
<literal>TIMESTAMP(6)</literal> when using microseconds). Formerly, the
fractional seconds part was simply omitted from the returned values. Please
note that this only affects the usage of <link
linkend="ref.pdo-mysql">PDO_MYSQL</link> with emulated prepares turned off
(e.g. using the native preparation functionality). Statements using
connections having <constant>PDO::ATTR_EMULATE_PREPARES</constant>=&true;
(which is the default) were not affected by the bug fixed and have already
been getting the proper fractional seconds values from the engine.
预处理语句现在可以正确报告带有小数位数说明符的 <literal>DATETIME</literal>、<literal>TIME</literal> 和 <literal>TIMESTAMP</literal>
列的带小数的秒(例如,使用微秒时为 <literal>TIMESTAMP(6)</literal>)。以前,返回值中简单地省略了秒的小数部分。请注意,这仅影响关闭模拟预处理时
<link linkend="ref.pdo-mysql">PDO_MYSQL</link> 的使用(例如使用原生预处理功能)。使用具有
<constant>PDO::ATTR_EMULATE_PREPARES</constant>=&true;(默认值)的连接的语句不受已修复错误的影响,并且已经从引擎获取了带正确小数的秒值。
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.reflection">
<title>Reflection</title>
<title>反射</title>

<para>
<link linkend="book.reflection">Reflection</link> export to string now uses
<literal>int</literal> and <literal>bool</literal> instead of
<literal>integer</literal> and <literal>boolean</literal>, respectively.
<link linkend="book.reflection">反射</link>导出为字符串,现在分别使用
<literal>int</literal> <literal>bool</literal> 而不是
<literal>integer</literal> <literal>boolean</literal>
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.spl">
<title>Standard PHP Library (SPL)</title>
<title>PHP 标准库(SPL</title>

<para>
If an <link linkend="book.spl">SPL</link> autoloader throws an exception,
following autoloaders will not be executed. Previously all autoloaders were
executed and exceptions were chained.
如果 <link linkend="book.spl">SPL</link> 自动加载器抛出异常,则不会执行后面的自动加载器。以前,所有自动加载器都会执行,并且会将异常链接起来。
</para>
</sect2>

<sect2 xml:id="migration73.incompatible.simplexml">
<title>SimpleXML</title>

<para>
Mathematic operations involving <link
linkend="book.simplexml">SimpleXML</link> objects will now treat the text as
an <type>int</type> or <type>float</type>, whichever is more appropriate.
Previously values were treated as <type>int</type>s unconditionally.
涉及 <link linkend="book.simplexml">SimpleXML</link> 对象的数学运算现在会将文本视为 <type>int</type>
或 <type>float</type>,以更合适者为准。以前,值会被无条件视为 <type>int</type>。
</para>
</sect2>


<sect2 xml:id="migration73.incompatible.cookie-decode">
<title>Incoming Cookies</title>
<title>传入 cookie</title>

<para>
As of PHP 7.3.23, the <emphasis>names</emphasis> of incoming cookies are no
longer url-decoded for security reasons.
从 PHP 7.3.23 起,出于安全原因,传入 cookie 的 <emphasis>names</emphasis> 不再进行 url 解码。
</para>
</sect2>

Expand Down
Loading

0 comments on commit 91ea1b1

Please sign in to comment.