From d8c795e865d57602d6fb41efc4179e62e2734b07 Mon Sep 17 00:00:00 2001 From: mowangjuanzi Date: Wed, 8 Nov 2023 10:38:14 +0800 Subject: [PATCH] Update appendices --- appendices/migration70/new-features.xml | 120 +++++++---------- appendices/migration70/new-functions.xml | 2 +- appendices/migration70/other-changes.xml | 15 +-- appendices/migration70/removed-exts-sapis.xml | 2 - appendices/migration70/sapi-changes.xml | 7 +- appendices/migration81/incompatible.xml | 125 ++++++++---------- appendices/migration81/other-changes.xml | 16 +-- appendices/migration82/new-functions.xml | 2 +- appendices/migration83/other-changes.xml | 125 ++++++------------ language-snippets.ent | 10 +- 10 files changed, 165 insertions(+), 259 deletions(-) diff --git a/appendices/migration70/new-features.xml b/appendices/migration70/new-features.xml index 9bc15a681..fe357211c 100644 --- a/appendices/migration70/new-features.xml +++ b/appendices/migration70/new-features.xml @@ -9,18 +9,16 @@ 标量类型声明 - 标量类型声明 - 有两种模式: 强制 (默认) 和 严格模式。 现在可以使用下列类型参数(无论用强制模式还是严格模式): - 字符串(string), 整数 (int), 浮点数 (float), - 以及布尔值 (bool)。它们扩充了PHP5中引入的其他类型:类名,接口,数组和 - 回调类型。 + 标量类型声明有两种模式: 强制(默认)和严格模式。现在可以使用下列类型参数(无论用强制模式还是严格模式) + 字符串(string)、整数(int)、浮点数(float)以及布尔值(bool)。它们扩充了 PHP 5 + 中引入的其他类型:类名、接口、arraycallable - 要使用严格模式,一个 &declare; 声明指令必须放在文件的顶部。这意味着严格声明标量是基于文件可配的。 - 这个指令不仅影响参数的类型声明,也影响到函数的返回值声明(参见 - 返回值类型声明, - 内置的PHP函数以及扩展中加载的PHP函数) + 要使用严格模式,&declare; 声明指令必须放在文件的顶部。这意味着严格声明标量是基于文件可配的。这个指令不仅影响参数的类型声明,也影响到函数的返回值声明(参见返回值类型声明,内置的 PHP 函数以及扩展中加载的 PHP 函数)。 完整的标量类型声明文档和示例参见类型声明章节。 - @@ -54,8 +49,8 @@ int(9) 返回值类型声明 - PHP 7 增加了对返回类型声明的支持。 - 类似于参数类型声明,返回类型声明指明了函数返回值的类型。可用的类型与参数声明中可用的类型相同。 + PHP 7 增加了对返回类型声明的支持。类似于参数类型声明,返回类型声明指明了函数返回值的类型。可用的类型与参数声明中可用的类型相同。 @@ -87,33 +82,28 @@ Array - 完整的标量类型声明文档和示例可参见 - 返回值类型声明. + 完整的标量类型声明文档和示例可参见返回值类型声明。 - null合并运算符 + null 合并运算符 - 由于日常使用中存在大量同时使用三元表达式和 isset的情况, - 我们添加了null合并运算符 (??) 这个语法糖。如果变量存在且值不为&null;, - 它就会返回自身的值,否则返回它的第二个操作数。 + 由于日常使用中存在大量同时使用三元表达式和 isset 的情况,我们添加了 null + 合并运算符(??)这个语法糖。如果变量存在且值不为 &null;,就会返回自身的值,否则返回第二个操作数。 ]]> @@ -127,8 +117,8 @@ $username = $_GET['user'] ?? $_POST['user'] ?? 'nobody'; 太空船操作符(组合比较符) - 太空船操作符用于比较两个表达式。当$a小于、等于或大于$b时它分别返回-1、0或1。 - 比较的原则是沿用 PHP 的常规比较规则进行的。 + 太空船操作符用于比较两个表达式。当 $a 小于、等于或大于 $b 时它分别返回 -1、0 或 + 1。比较的原则是沿用 PHP 的常规比较规则进行的。 @@ -162,7 +152,7 @@ echo "b" <=> "a"; // 1 Array 类型的常量现在可以通过 - define 来定义。在 PHP5.6 中仅能通过 &const; 定义。 + define 来定义。在 PHP 5.6 中仅能通过 &const; 定义。 @@ -186,7 +176,7 @@ echo ANIMALS[1]; // 输出 "cat" 匿名类 - 现在支持通过new class 来实例化一个匿名类,这可以用来替代一些“用后即焚”的完整类定义。 + 现在支持通过 new class 来实例化匿名类,这可以用来替代一些“用后即焚”的完整类定义。 @@ -230,8 +220,7 @@ object(class@anonymous)#2 (0) { - 详细文档可以参考 - 匿名类. + 详细文档可以参考匿名类。 @@ -239,8 +228,8 @@ object(class@anonymous)#2 (0) { Unicode codepoint 转译语法 - 这接受一个以16进制形式的 Unicode codepoint,并打印出一个双引号或heredoc包围的 UTF-8 编码格式的字符串。 - 可以接受任何有效的 codepoint,并且开头的 0 是可以省略的。 + 这接受一个以 16 进制形式的 Unicode codepoint,并打印出一个双引号或 heredoc 包围的 UTF-8 + 编码格式的字符串。可以接受任何有效的 codepoint,并且开头的 0 是可以省略的。 @@ -347,7 +336,7 @@ bool(true) - 若要使用此类,请先安装Intl扩展 + 若要使用此类,请先安装 Intl 扩展。 @@ -355,12 +344,12 @@ bool(true) 预期 - 预期是向后兼用并增强之前的 assert 的方法。 - 它使得在生产环境中启用断言为零成本,并且提供当断言失败时抛出特定异常的能力。 + 预期是向后兼用并增强之前的 assert 的方法。它使得在生产环境中启用断言为零成本,并且提供当断言失败时抛出特定异常的能力。 - 老版本的API出于兼容目的将继续被维护,assert现在是一个语言结构,它允许第一个参数是一个表达式,而不仅仅是一个待计算的 string或一个待测试的boolean。 + 老版本的 API 出于兼容目的将继续被维护,assert 现在是语言结构,它允许第一个参数是表达式,而不仅仅是待计算的 + string 或待测试的 boolean @@ -391,8 +380,7 @@ Fatal error: Uncaught CustomError: Some error message <literal>use</literal> 组声明 - 从同一 &namespace; 导入的类、函数和常量现在可以通过单个 &use.namespace; 语句 - 一次性导入了。 + 从同一 &namespace; 导入的类、函数和常量现在可以通过单个 &use.namespace; 语句一次性导入了。 @@ -426,11 +414,9 @@ use const some\namespace\{ConstA, ConstB, ConstC}; 生成器可以返回表达式 - 此特性基于 PHP 5.5 版本中引入的生成器特性构建的。 - 它允许在生成器函数中通过使用 return 语法来返回一个表达式 - (但是不允许返回引用值), - 可以通过调用 Generator::getReturn() 方法来获取生成器的返回值, - 但是这个方法只能在生成器完成产生工作以后调用一次。 + 此特性基于 PHP 5.5 版本中引入的生成器特性构建的。它允许在生成器函数中通过使用 return + 语法来返回一个表达式(但是不允许返回引用值),可以通过调用 Generator::getReturn() + 方法来获取生成器的返回值,但是这个方法只能在生成器完成产生工作以后调用一次。 @@ -463,10 +449,7 @@ echo $gen->getReturn(), PHP_EOL; - 在生成器中能够返回最终的值是一个非常便利的特性, - 因为它使得调用生成器的客户端代码可以直接得到生成器(或者其他协同计算)的返回值, - 相对于之前版本中客户端代码必须先检查生成器是否产生了最终的值然后再进行响应处理 - 来得方便多了。 + 在生成器中能够返回最终的值是一个非常便利的特性,因为它使得调用生成器的客户端代码可以直接得到生成器(或者其他协同计算)的返回值,相对于之前版本中客户端代码必须先检查生成器是否产生了最终的值然后再进行响应处理来得方便多了。 @@ -519,8 +502,7 @@ foreach (gen() as $val) 整数除法函数 <function>intdiv</function> - 新加的函数 intdiv 用来进行 - 整数的除法运算。 + 新加的函数 intdiv 用来进行整数的除法运算。 @@ -544,24 +526,19 @@ int(3) 会话选项 - session_start 可以接受一个 array 作为参数, - 用来覆盖 php.ini 文件中设置的 - 会话配置选项。 + session_start 可以接受 array 作为参数,用来覆盖 + php.ini 文件中设置的会话配置选项。 - 在调用 session_start 的时候, - 传入的选项参数中也支持 - session.lazy_write 行为, - 默认情况下这个配置项是打开的。它的作用是控制 PHP 只有在会话中的数据发生变化的时候才 - 写入会话存储文件,如果会话中的数据没有发生改变,那么 PHP 会在读取完会话数据之后, - 立即关闭会话存储文件,不做任何修改,可以通过设置 - read_and_close 来实现。 + 在调用 session_start 的时候,传入的选项参数中也支持 session.lazy_write + 行为,默认情况下这个配置项是打开的。它的作用是控制 PHP 只有在会话中的数据发生变化的时候才写入会话存储文件,如果会话中的数据没有发生改变,那么 + PHP 会在读取完会话数据之后,立即关闭会话存储文件,不做任何修改,可以通过设置 read_and_close 来实现。 - 例如,下列代码设置 - session.cache_limiter 为 + 例如,下列代码设置 session.cache_limiter 为 private,并且在读取完毕会话数据之后马上关闭会话存储文件。 @@ -583,16 +560,13 @@ session_start([ <function>preg_replace_callback_array</function> - 在 PHP 7 之前,当使用 preg_replace_callback 函数的时候, - 由于针对每个正则表达式都要执行回调函数,可能导致过多的分支代码。 - 而使用新加的 preg_replace_callback_array 函数, - 可以使得代码更加简洁。 + 在 PHP 7 之前,当使用 preg_replace_callback + 函数的时候,由于针对每个正则表达式都要执行回调函数,可能导致过多的分支代码。而使用新加的 + preg_replace_callback_array 函数,可以使得代码更加简洁。 - 现在,可以使用一个关联数组来对每个正则表达式注册回调函数, - 正则表达式本身作为关联数组的键, - 而对应的回调函数就是关联数组的值。 + 现在,可以使用一个关联数组来对每个正则表达式注册回调函数,正则表达式本身作为关联数组的键,而对应的回调函数就是关联数组的值。 @@ -612,9 +586,8 @@ session_start([ - 在之前版本中,list 函数不能保证 - 正确的展开实现了 ArrayAccess 接口的对象, - 现在这个问题已经被修复。 + 在之前版本中,list 函数不能保证正确的展开实现了 ArrayAccess + 接口的对象,现在这个问题已经被修复。 @@ -623,8 +596,7 @@ session_start([ - 允许在克隆表达式上访问对象成员,例如: - (clone $foo)->bar()。 + 允许在克隆表达式上访问对象成员,例如:(clone $foo)->bar() diff --git a/appendices/migration70/new-functions.xml b/appendices/migration70/new-functions.xml index d481c7178..819c32328 100644 --- a/appendices/migration70/new-functions.xml +++ b/appendices/migration70/new-functions.xml @@ -168,7 +168,7 @@ - <link linkend="book.zlib">Zlib Compression</link> + <link linkend="book.zlib">Zlib 压缩</link> diff --git a/appendices/migration70/other-changes.xml b/appendices/migration70/other-changes.xml index 35873841e..084f000c1 100644 --- a/appendices/migration70/other-changes.xml +++ b/appendices/migration70/other-changes.xml @@ -2,16 +2,14 @@ - - Other Changes + 其它变更 放宽了保留词限制 - 现在允许全局保留词用于类/接口/Trait 中的属性、常量和方法名。 - 在引入新关键词时,此变更减少了对向后兼容的破坏,避免了 API 命名的限制。 + 现在允许全局保留词用于 class、interface、Trait 中的属性、常量和方法名。在引入新关键词时,此变更减少了对向后兼容的破坏,避免了 API 命名的限制。 @@ -29,8 +27,7 @@ Project::new('Project Name')->private()->for('purpose here')->with('username her - 唯一的限制是: class关键词不能用于常量名,否则会和 - 类名解析语法冲突 (ClassName::class)。 + 唯一的限制是 class 关键词不能用于常量名,否则会和类名解析语法冲突(ClassName::class)。 @@ -38,10 +35,8 @@ Project::new('Project Name')->private()->for('purpose here')->with('username her 移除 date.timezone 警告 - 调用任意 date- 开头或者其他基于时间的函数时, - 未设置 date.timezone INI 设置的情况下, - 之前会产生警告。 - 现在移除了警告(date.timezone 默认仍然是 UTC) + 调用任意 date- 开头或者其他基于时间的函数时,未设置 date.timezone INI + 设置的情况下,之前会产生警告。现在移除了警告(date.timezone 默认仍然是 UTC)。 diff --git a/appendices/migration70/removed-exts-sapis.xml b/appendices/migration70/removed-exts-sapis.xml index acd17ef8e..774cf2807 100644 --- a/appendices/migration70/removed-exts-sapis.xml +++ b/appendices/migration70/removed-exts-sapis.xml @@ -1,8 +1,6 @@ - - 移除的扩展和 SAPI diff --git a/appendices/migration70/sapi-changes.xml b/appendices/migration70/sapi-changes.xml index 938ea47d2..a9a2d38de 100644 --- a/appendices/migration70/sapi-changes.xml +++ b/appendices/migration70/sapi-changes.xml @@ -1,8 +1,6 @@ - - SAPI 模块的变化 @@ -16,9 +14,8 @@ - 在 PHP 5 中,listen 指令如果仅带一个端口数字, - 则会监听所有网络接口,但只是 IPv4。 - 现在 PHP 7 会同时接受来自 IPv4 和 IPv6 上的请求。 + 在 PHP 5 中,listen 指令如果仅带一个端口数字,则会监听所有网络接口,但只是 + IPv4。现在 PHP 7 会同时接受来自 IPv4 和 IPv6 上的请求。 diff --git a/appendices/migration81/incompatible.xml b/appendices/migration81/incompatible.xml index 7f06f79b7..bebed11ba 100644 --- a/appendices/migration81/incompatible.xml +++ b/appendices/migration81/incompatible.xml @@ -12,11 +12,11 @@ $GLOBALS 访问限制 - 现在访问 $GLOBALS 数组受到一些限制。 - 对单个数组元素的读写访问 $GLOBALS['var'] 与之前一样。 - 也将继续支持对整个数组 $GLOBALS 的只读访问。 - 但是,不再支持对整个 $GLOBALS 数组的写访问。 - 例如,array_pop($GLOBALS) 将返回错误。 + 现在访问 $GLOBALS 数组受到一些限制。对单个数组元素的读写访问 + $GLOBALS['var'] 与之前一样。也将继续支持对整个数组 + $GLOBALS 的只读访问。但是,不再支持对整个 + $GLOBALS 数组的写访问。例如 + array_pop($GLOBALS) 将返回错误。 @@ -47,7 +47,6 @@ var_dump(B::counter()); // int(4),之前是 int(2) ]]> - 这意味着方法中的静态变量现在的使用方式与静态属性一样。 @@ -100,9 +99,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed - Note that a default value of &null; can be used before required parameters to - specify a nullable type, - but the parameter will still be required. + 注意,在强制参数之前可以使用 &null; 默认值来指定可为空类型,但仍然需要该参数。 @@ -110,8 +108,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed 返回类型与内部类的兼容性 - 大多数非 Final 的内部方法现在要求重写方法声明一个可兼容的返回类型,否则在继承时会给出方法废弃的提示。 - 如果由于 PHP 跨版本兼容性的问题,导致不能为重写方法声明返回类型,则可以添加 ReturnTypeWillChange 注解来取消废弃提示。 + 大多数非 final 的内部方法现在要求重写方法声明一个可兼容的返回类型,否则在继承时会给出方法废弃的提示。如果由于 + PHP 跨版本兼容性的问题,导致不能为重写方法声明返回类型,则可以添加 ReturnTypeWillChange 注解来取消废弃提示。 @@ -131,74 +129,74 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed Resource 类型迁移为 Object 类型 - 一些 &resource; 类型已被迁移到 &object; 类型。 - 要检查返回值,应该从 is_resource 检查是否为资源,更改为检查返回值是否等于 &false;。 + 一些 &resource; 类型已被迁移到 &object; 类型。要检查返回值,应该从 is_resource + 检查是否为资源,更改为检查返回值是否等于 &false;。 - 现在 FileInfo 函数接收并返回 finfo 对象类型, - 而不是 fileinfo &resource; 类型。 + 现在 FileInfo 函数接收并返回 finfo + 对象类型,而不是 fileinfo &resource; 类型。 - 现在 FTP 函数接收并返回 FTP\Connection 对象类型, - 而不是 ftp &resource; 类型。 + 现在 FTP 函数接收并返回 FTP\Connection + 对象类型,而不是 ftp &resource; 类型。 - 现在 IMAP 函数接收并返回 IMAP\Connection 对象类型, - 而不是 imap &resource; 类型。 + 现在 IMAP 函数接收并返回 IMAP\Connection + 对象类型,而不是 imap &resource; 类型。 - 现在 LDAP 函数接收并返回 LDAP\Connection 对象类型, - 而不是 ldap link &resource; 类型。 + 现在 LDAP 函数接收并返回 LDAP\Connection + 对象类型,而不是 ldap link &resource; 类型。 - 现在 LDAP 函数接收并返回 LDAP\Result 对象类型, - 而不是 ldap result &resource; 类型。 + 现在 LDAP 函数接收并返回 LDAP\Result + 对象类型,而不是 ldap result &resource; 类型。 - 现在 LDAP 函数接收并返回 LDAP\ResultEntry 对象类型, - 而不是 ldap result entry &resource; 类型。 + 现在 LDAP 函数接收并返回 LDAP\ResultEntry + 对象类型,而不是 ldap result entry &resource; 类型。 - 现在 PgSQL 函数接收并返回 PgSql\Connection 对象类型, - 而不是 pgsql link &resource; 类型。 + 现在 PgSQL 函数接收并返回 PgSql\Connection + 对象类型,而不是 pgsql link &resource; 类型。 - 现在 PgSQL 函数接收并返回 PgSql\Result 对象类型, - 而不是 pgsql result &resource; 类型。 + 现在 PgSQL 函数接收并返回 PgSql\Result + 对象类型,而不是 pgsql result &resource; 类型。 - 现在 PgSQL 函数接收并返回 PgSql\Lob 对象类型, - 而不是 pgsql large object &resource; 类型。 + 现在 PgSQL 函数接收并返回 PgSql\Lob + 对象类型,而不是 pgsql large object &resource; 类型。 - 现在 PSpell 函数接收并返回 PSpell\Dictionary 对象类型, - 而不是 pspell &resource; 类型。 + 现在 PSpell 函数接收并返回 PSpell\Dictionary + 对象类型,而不是 pspell &resource; 类型。 - 现在 PSpell 函数接收并返回 PSpell\Config 对象类型, - 而不是 pspell config &resource; 类型。 + 现在 PSpell 函数接收并返回 PSpell\Config + 对象类型,而不是 pspell config &resource; 类型。 @@ -208,9 +206,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed MySQLi - 现在 mysqli_fetch_fields 和 - mysqli_fetch_field_direct 对于 max_length 将返回 0 值。 - 这一信息可以迭代结果集来计算,并获取最大长度。这是之前 PHP 内部的做法。 + 现在 mysqli_fetch_fieldsmysqli_fetch_field_direct 对于 max_length + 将返回 0 值。这一信息可以迭代结果集来计算,并获取最大长度。这是之前 PHP 内部的做法。 @@ -218,8 +215,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed - 常量 MYSQLI_STORE_RESULT_COPY_DATA 不再生效。 - 传递给 mysqli::store_resultmode 参数的所有值不再生效。 + 常量 MYSQLI_STORE_RESULT_COPY_DATA 不再生效。传递给 mysqli::store_result + 的 mode 参数的所有值不再生效。 @@ -227,9 +224,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed - 默认错误处理模式已经由 silent 变成了 exceptions,更多详情及如何设置该属性请参见 MySQLi reporting mode 。 - 要恢复之前的行为习惯,请使用: - mysqli_report(MYSQLI_REPORT_OFF); + 默认错误处理模式已经由 silent 变成了 exception,更多详情及如何设置该属性请参见 MySQLi + 报告模式。要恢复之前的行为习惯,请使用:mysqli_report(MYSQLI_REPORT_OFF); @@ -241,9 +237,7 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed MySQLnd - mysqlnd.fetch_data_copy - INI 指令已被取消。 - 这不会造成用户可见的变化。 + mysqlnd.fetch_data_copy INI 指令已被取消。这不会造成用户可见的变化。 @@ -254,9 +248,8 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed 现在 EC 私钥将以 PKCS#8 格式导出,而非像其他秘钥那样的传统格式。 - 现在 openssl_pkcs7_encrypt 和 - openssl_cms_encrypt 将默认使用 AES-128-CBC,而非 RC2-40。 - RC2-40 加密被认为是不安全的,OpenSSL 3 默认不启用。 + 现在 openssl_pkcs7_encryptopenssl_cms_encrypt 将默认使用 AES-128-CBC,而非 + RC2-40。RC2-40 加密被认为是不安全的,OpenSSL 3 默认不启用。 @@ -268,18 +261,16 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed "1"。之前的 &boolean; 类型没有被字符串化。 - 现在当 PDO::ATTR_STRINGIFY_FETCHES 被禁用时, - 以 PDO::PARAM_LOB 为参数调用 PDOStatement::bindColumn 结果将总是绑定一个流。 - 以前,结果要么是一个流,要么是一个字符串,这取决于所用的数据库驱动及其执行的时间。 + 现在当 PDO::ATTR_STRINGIFY_FETCHES 未启用时,以 PDO::PARAM_LOB 为参数调用 + PDOStatement::bindColumn 结果将始终绑定流。以前,结果是流或字符串,这取决于所用的数据库驱动及其执行绑定的时间。 MySQL 驱动 - 现在,当使用模拟预处理时,结果集中的整数及浮点数将会以 PHP 原始类型返回,而不是以 &string; 类型返回。 - 这与原生的预处理方式一样。 - 之前的行为方式可以通过 PDO::ATTR_STRINGIFY_FETCHES 恢复。 + 现在,当使用模拟预处理时,结果集里面的整数及浮点数将会以 PHP 原始类型返回,而不是字符串。这与原生的预处理方式一样。之前的行为方式可以通过 + PDO::ATTR_STRINGIFY_FETCHES 恢复。 @@ -287,8 +278,7 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed SQLite 驱动 - 现在,结果集中的整数及浮点数将会以 PHP 原始类型返回。 - 之前的行为方式可以通过 PDO::ATTR_STRINGIFY_FETCHES 恢复。 + 现在,结果集中的整数及浮点数将会以 PHP 原始类型返回。之前的行为方式可以通过 PDO::ATTR_STRINGIFY_FETCHES 恢复。 @@ -297,33 +287,28 @@ ArgumentCountError - makeyogurt(): Argument #1 ($container) not passed Phar - 为了遵守 ArrayAccess 接口, - Phar::offsetUnset 和 + 为了遵守 ArrayAccess 接口,Phar::offsetUnsetPharData::offsetUnset 不再以 &boolean; 类型返回。 - Standard + 常规 version_compare 函数不再接收未经记录的操作符缩写。 - 现在 htmlspecialchars、 - htmlentities、 - htmlspecialchars_decode、 - html_entity_decode、 - get_html_translation_table - 使用 ENT_QUOTES | ENT_SUBSTITUTE 作为默认值,而不再是 ENT_COMPAT。 - 这意味着 ' 被转义为 &#039; 而不像之前那样不作处理。 - 此外,有缺陷的 UTF-8 将被 Unicode 替代字符(substitute character)替换,而不是产生一个空字符串。 + 现在 htmlspecialcharshtmlentitieshtmlspecialchars_decodehtml_entity_decodeget_html_translation_table + 使用 ENT_QUOTES | ENT_SUBSTITUTE 作为默认值,而不再是 ENT_COMPAT。这意味着 + ' 被转义为 &#039; 而不像之前那样不作处理。此外,有缺陷的 + UTF-8 将被 Unicode 替代字符(substitute character)替换,而不是产生一个空字符串。 - 现在 debug_zval_dump 函数可以打印封装的引用计数了,不仅仅只是打印 & 引用计数的值。 - 这更准确地模拟了自 PHP 7.0 以来的引用注解。 + 现在 debug_zval_dump 函数可以打印封装的引用计数了,不仅仅只是打印 & + 引用计数的值。这更准确地模拟了自 PHP 7.0 以来的引用注解。 diff --git a/appendices/migration81/other-changes.xml b/appendices/migration81/other-changes.xml index 1bd2cf632..c0b4ae2eb 100644 --- a/appendices/migration81/other-changes.xml +++ b/appendices/migration81/other-changes.xml @@ -1,7 +1,6 @@ - 其他变更 @@ -35,13 +34,11 @@ 核心 - 在 &foreach;、var_dump - 、serialize、对象对比等场景中属性的顺序发生了改变。 - 现在,属性将根据它们的声明与继承进行排序,在基类中声明的属性将排在子类属性之前。 + 在 &foreach;、var_dumpserialize、对象比较等场景中属性的顺序发生了改变。现在,属性将根据它们的声明与继承进行排序,在基类中声明的属性将排在子类属性之前。 这个顺序与 zend_object 结构中属性的内部布局保持一致,并且重复了 - default_properties_table[]properties_info_table[] + default_properties_table[]properties_info_table[] 中的顺序。旧的顺序没有被记录下来,是由类的继承实现细节造成的。 @@ -59,8 +56,7 @@ GMP - 所有的 GMP 函数现在接受带八进制前缀( - "0o"/"0O")的八进制字符串。 + 所有的 GMP 函数现在接受带八进制前缀("0o"/"0O")的八进制字符串。 @@ -124,7 +120,7 @@ - OpenSSL 扩展 现在至少需要 OpenSSL 1.0.2 版本。 + OpenSSL 扩展现在至少需要 OpenSSL 1.0.2 版本。 @@ -194,8 +190,8 @@ 双引号内的字符串中反斜线现在被更一致地视为转义字符。之前 "foo\\" 的后面如果是除换行之外的其他字符是不被视为一个终止字符串的。现在,它被解释成一个内容为 - foo\的字符串。然而有一个例外的地方是后面跟着换行符的字符串 "foo\" - 将继续被视为一个有效的、内容为 "foo\" 的字符串,而不是一个还没有结束的字符串。这个例外的存在是为了天然支持 Windows 文件路径的使用,如 + foo\ 的字符串。然而有一个例外的地方是后面跟着换行符的字符串 "foo\" + 将继续被视为一个有效的、内容为“foo\”的字符串,而不是一个还没有结束的字符串。这个例外的存在是为了天然支持 Windows 文件路径的使用,如 "C:\foo\" diff --git a/appendices/migration82/new-functions.xml b/appendices/migration82/new-functions.xml index 453b731e7..cccd7fca2 100644 --- a/appendices/migration82/new-functions.xml +++ b/appendices/migration82/new-functions.xml @@ -62,7 +62,7 @@ - Standard + 标准 memory_reset_peak_usage ini_parse_quantity diff --git a/appendices/migration83/other-changes.xml b/appendices/migration83/other-changes.xml index 311055c64..f95fbe2ee 100644 --- a/appendices/migration83/other-changes.xml +++ b/appendices/migration83/other-changes.xml @@ -1,8 +1,8 @@ - + - 其它变化 + 其它变更 核心变化 @@ -174,13 +174,9 @@ MBString - mb_strtolower and mb_convert_case - implement conditional casing rules for the Greek letter sigma. - For mb_convert_case, - conditional casing only applies to MB_CASE_LOWER - and MB_CASE_TITLE modes, not to - MB_CASE_LOWER_SIMPLE and - MB_CASE_TITLE_SIMPLE. + mb_strtolowermb_convert_case 实现了对希腊字母 sigma + 的条件转换规则,条件转换只适用于 MB_CASE_LOWERMB_CASE_TITLE + 模式,不适用于 MB_CASE_LOWER_SIMPLEMB_CASE_TITLE_SIMPLE @@ -193,25 +189,16 @@ - mb_encode_mimeheader no longer drops NUL (zero) - bytes when QPrint-encoding the input string. - This previously caused strings in certain text encodings, especially - UTF-16 and UTF-32, to be corrupted by mb_encode_mimeheader. + 当输入字符串使用 QPrint 编码时,mb_encode_mimeheader + 不再丢弃 NUL(零)字节。之前会导致某些文本编码的字符串,特别是 UTF-16 和 + UTF-32,会被 mb_encode_mimeheader 破坏。 - mb_detect_encoding 现在的的“非严格”模式行为如文档中所述。 - Previously, it would return &false; if the same byte (for example, the first - byte) of the input string was invalid in all candidate encodings. - More generally, it would eliminate candidate encodings from consideration - when an invalid byte was seen, and if the same input byte eliminated all - remaining encodings still under consideration, it would return &false;. - On the other hand, if all candidate encodings but one were eliminated - from consideration, it would return the last remaining one without regard - for how many encoding errors might be encountered later in the string. - This is different from the behavior described in the documentation, which - says: "If strict is set to false, the closest matching encoding will be - returned." + mb_detect_encoding 现在的的“非严格”模式行为如文档中所述。之前,如果在所有候选编码中输入字符串的相同字节(比如,第一个字节)是无效的,将会返回 + &false;。一般来说,当看到无效字节时,将会从考虑(consideration)中剔除候选编码,如果相同的输入字节剔除了考虑中的所有剩余编码,将返回 + &false;。另一方面,如果所有的候选编码一个个都剔除了,它将返回最后剔除的那个,而不考虑字符串中可能遇到的编码错误。这与文档中描述的行为不同,文档中说:“如果 strict + 设置为 false,将返回最接近的匹配编码”。 @@ -345,24 +332,19 @@ 核心 - Using the increment/decrement - operators (++/--) on values of type - bool now emit warnings. - This is because it currently has no effect, but will behave like - $bool += 1 in the future. + 在类型 bool 的值上使用 + 自增/减运算符(++/--)将会抛出警告。这是因为虽然目前没有效果,但是将来行为将是 + $bool += 1 - Using the decrement - operator (--) on values of type null now emit warnings. - This is because it currently has no effect, but will behave like - $null -= 1 in the future. + 在类型 null 的值上使用 + 自减运算符(--)将会抛出警告。这是因为虽然目前没有效果,但是将来行为将是 + $null -= 1 - Internal objects that implement an _IS_NUMBER cast but not a do_operator - handler that overrides addition and subtraction now can be incremented - and decrement as if one would do $o += 1 or $o -= 1 + 内部对象实现 _IS_NUMBER 转换,但不是重写加减法的 do_operator 处理程序,现在可以像 $o += 1$o -= 1 一样递增和递减。 @@ -370,8 +352,7 @@ DOM - The DOM lifetime mechanism has been reworked such that implicitly removed - nodes can still be fetched. Previously this resulted in an exception. + DOM 的生命周期机制已经被重写,这样默默删除的节点仍然可以获取,之前这样做会导致异常。 @@ -379,14 +360,11 @@ SQLite3 - The SQLite3 class now throws - SQLite3Exception (extends - Exception) instead of Exception. + SQLite3 类现在抛出 SQLite3Exception(继承 Exception)而不是 Exception - The SQLite error code is now passed in the exception error code instead of - being included in the error message. + SQLite 错误代码现在在 exception error code 中传递,而不是包含在错误消息中。 @@ -398,8 +376,7 @@ - The assert.* INI settings have been deprecated. - This comprises the following INI settings: + 已弃用 assert.* INI 设置。这包括以下 INI 设置: assert.active assert.bail @@ -407,44 +384,27 @@ assert.exception assert.warning - If the value of the setting is equal to the default value, no deprecation - notice is emitted. - The zend.assertions INI setting - should be used instead. + 如果设置的值等于默认值,则不会发出弃用通知。应该使用 zend.assertions INI 设置。 - zend.max_allowed_stack_size - is a new INI directive to set the maximum allowed stack size. - Possible values are 0 (detect the process or thread maximum stack size), - -1 (no limit), or a positive number of bytes. - The default is 0. - When it is not possible to detect the process or thread maximum stack - size, a known system default is used. - Setting this value too high has the same effect as disabling the stack size limit. - Fibers use - fiber.stack_size - as maximum allowed stack size. - An Error is thrown when the process call stack exceeds - zend.max_allowed_stack_size-zend.reserved_stack_size - bytes, to prevent stack-overflow-induced segmentation faults, with - the goal of making debugging easier. - The stack size increases during uncontrolled recursions involving internal functions - or the magic methods - __toString(), - __clone(), - __sleep(), - __destruct(). - This is not related to stack buffer overflows, and is not a security feature. + zend.max_allowed_stack_size 是新的 INI + 指令,用于设置允许的最大栈大小。可能的值是 + 0(检测进程或线程的最大栈大小)、-1(无限制)或正数的单位为字节的值。默认值为 + 0。当无法检测到进程或线程的最大的栈大小时,使用已知的系统默认值。设置的值过高效果等同于不限制栈的大小。Fiber + 使用 fiber.stack_size 作为允许的最大栈大小。当进程调用栈超过 + zend.max_allowed_stack_size-zend.reserved_stack_size 个字节时,将抛出 + Error,以防止栈溢出引发分段错误,目的是使调试更容易。在没有控制递归调用内部函数或者魔术方法 __toString()、__clone()、__sleep()、__destruct() + 期间,栈的大小会增加。这与栈缓冲区溢出无关,也不是安全特性。 - zend.reserved_stack_size - is a new INI directive to set the reserved stack size, in bytes. - This is subtracted from the max allowed stack size, - as a buffer, when checking the stack size. + zend.reserved_stack_size 是新的 INI + 指令,用于设置预留的栈大小(以字节为单位)。当检查栈大小时,会从最大允许的栈大小中减去,作为缓冲区。 @@ -457,17 +417,15 @@ DOM - Looping over a DOMNodeList now uses caching. Therefore - requesting items no longer takes quadratic time by default. + 现在遍历 DOMNodeList 时使用了缓存,因此默认情况下请求元素不再需要花费两次的时间。 - Getting text content from nodes now avoids an allocation, resulting in a - performance gain. + 从节点获取文本内容现在避免了分配,从而提高了性能。 - DOMChildNode::remove now runs in O(1) performance. + DOMChildNode::remove 现在运行性能是 O(1)。 @@ -475,7 +433,7 @@ 标准 - The file flags error check is now about 7% faster. + file flags 错误检查现在快了大约 7%。 @@ -483,8 +441,7 @@ SPL - RecursiveDirectoryIterator now performs less I/O - when looping over a directory. + RecursiveDirectoryIterator 现在循环目录时执行更少的 I/O。 diff --git a/language-snippets.ent b/language-snippets.ent index 3ec898c91..4a3734353 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -1,6 +1,6 @@ - + @@ -2904,13 +2904,19 @@ used.'> '> + kmsProviders array A document containing the configuration for one or more KMS providers, which are used to encrypt data keys. Supported providers include "aws", "azure", "gcp", "kmip", and "local" and at least one must be specified. + + If an empty document is specified for "aws", + "azure", or "gcp", the driver + will attempt to configure the provider using + Automatic Credentials. + The format for "aws" is as follows: