From ef18f8129f1cfd8dfbd95c2638b2019a51837bd0 Mon Sep 17 00:00:00 2001 From: mowangjuanzi Date: Thu, 9 Nov 2023 00:38:08 +0800 Subject: [PATCH] Update appendices --- appendices/migration71/changed-functions.xml | 54 ++---- appendices/migration71/constants.xml | 2 - appendices/migration71/deprecated.xml | 11 +- appendices/migration71/incompatible.xml | 44 ++--- appendices/migration80.xml | 6 +- appendices/migration80/incompatible.xml | 184 +++++++------------ appendices/migration80/new-features.xml | 35 ++-- appendices/migration80/other-changes.xml | 60 +++--- appendices/migration81/new-features.xml | 78 ++++---- language-snippets.ent | 8 +- 10 files changed, 191 insertions(+), 291 deletions(-) diff --git a/appendices/migration71/changed-functions.xml b/appendices/migration71/changed-functions.xml index f71793213..a8511500e 100644 --- a/appendices/migration71/changed-functions.xml +++ b/appendices/migration71/changed-functions.xml @@ -1,8 +1,6 @@ - - 变动的函数 @@ -16,22 +14,17 @@ - getopt 函数增加了第三个参数,这是一个可选参数。 - 通过以引用的方式传入参数, - 它可以用来存储参数列表中下一个参数的下标位置。 + getopt 函数增加了第三个参数,这是一个可选参数。通过以引用的方式传入参数,它可以用来存储参数列表中下一个参数的下标位置。 - getenv 可以不传入任何参数。 - 如果不传入参数,此函数会以关联数组的形式 - 返回所有的环境变量。 + getenv 可以不传入任何参数。如果不传入参数,此函数会以关联数组的形式返回所有的环境变量。 - get_headers 增加了一个参数, - 可以用来解析自定义的流上下文。 + get_headers 增加了一个参数,可以用来解析自定义的流上下文。 @@ -42,14 +35,12 @@ - parse_url 更加严格的限制, - 并且提供对 RFC3986 的支持。 + parse_url 更加严格的限制,并且提供对 RFC3986 的支持。 - unpack 函数增加第三个参数, - 这是一个可选参数,用来指定开始解包的位置。 + unpack 函数增加第三个参数,这是一个可选参数,用来指定开始解包的位置。 @@ -60,8 +51,7 @@ - file_get_contents 接受负数作为搜索偏移量, - 前提是流上下文必须是可搜索的。 + file_get_contents 接受负数作为搜索偏移量,前提是流上下文必须是可搜索的。 @@ -78,10 +68,9 @@ - json_encode 增加新的选项: - JSON_UNESCAPED_LINE_TERMINATORS。 - 这个选项可以在指定 JSON_UNESCAPED_UNICODE 选项的时候, - 对于 U+2028 和 U+2029 这两个字符不再进行转义。 + json_encode 增加新的选项 + JSON_UNESCAPED_LINE_TERMINATORS。这个选项可以在指定 JSON_UNESCAPED_UNICODE + 选项的时候,对于 U+2028 和 U+2029 这两个字符不再进行转义。 @@ -108,9 +97,8 @@ - PDO::lastInsertId 在用于 PostgreSQL 数据库的时候, - 如果当前会话(到 PostgreSQL 的数据库连接)上尚未调用过 nextval, - 那么此方法会触发一个错误。 + PDO::lastInsertId 在用于 PostgreSQL 数据库的时候,如果当前会话(到 PostgreSQL + 的数据库连接)上尚未调用过 nextval,那么此方法会触发一个错误。 @@ -121,24 +109,21 @@ - pg_last_notice 增加一个用来指定操作的可选参数。 - 可使用以下常量作为此参数的值: PGSQL_NOTICE_LAST, - PGSQL_NOTICE_ALL 或 + pg_last_notice 增加一个用来指定操作的可选参数。可使用以下常量作为此参数的值 + PGSQL_NOTICE_LASTPGSQL_NOTICE_ALLPGSQL_NOTICE_CLEAR - pg_fetch_all 增加第二个参数,这是一个可选参数, - 它用来指定返回结果的类型 - (类似于 pg_fetch_array 的第三个参数)。 + pg_fetch_all 增加第二个参数,这是一个可选参数,它用来指定返回结果的类型(类似于 + pg_fetch_array 的第三个参数)。 - pg_select 增加第四个参数,这是一个可选参数, - 它用来指定返回结果的类型 - (类似于 pg_fetch_array 的第三个参数)。 + pg_select 增加第四个参数,这是一个可选参数,它用来指定返回结果的类型(类似于 + pg_fetch_array 的第三个参数)。 @@ -149,9 +134,8 @@ - session_start 当无法成功初始化会话的时候,返回 &false;, - 并且不会初始化超级变量 - $_SESSION。 + session_start 当无法成功初始化会话的时候,返回 &false;,并且不会初始化超级变量 + $_SESSION diff --git a/appendices/migration71/constants.xml b/appendices/migration71/constants.xml index 8a9effe4a..862692ce2 100644 --- a/appendices/migration71/constants.xml +++ b/appendices/migration71/constants.xml @@ -1,8 +1,6 @@ - - 新增的全局常量 diff --git a/appendices/migration71/deprecated.xml b/appendices/migration71/deprecated.xml index 257fdb052..c374e9db9 100644 --- a/appendices/migration71/deprecated.xml +++ b/appendices/migration71/deprecated.xml @@ -1,8 +1,6 @@ - - PHP 7.1.x 中废弃的特性 @@ -10,17 +8,16 @@ ext/mcrypt - mcrypt 扩展已经过时了大约10年,并且用起来很复杂。因此它被废弃并且被 OpenSSL 所取代。 - 从PHP 7.2起它将被从核心代码中移除并且移到PECL中。 + mcrypt 扩展已经过时了大约 10 年,并且用起来很复杂。因此它被废弃并且被 OpenSSL 所取代。从 PHP 7.2 起它将被从核心代码中移除并且移到 PECL 中。 - <function>mb_ereg_replace</function>和<function>mb_eregi_replace</function>的Eval选项 + <function>mb_ereg_replace</function> 和 <function>mb_eregi_replace</function> 的 Eval 选项 - 对于mb_ereg_replacemb_eregi_replace的 - e模式修饰符现在已被废弃。 + 对于 mb_ereg_replacemb_eregi_replace 的 + e 模式修饰符现在已被废弃。 diff --git a/appendices/migration71/incompatible.xml b/appendices/migration71/incompatible.xml index 81f4ffdff..2289a3ccd 100644 --- a/appendices/migration71/incompatible.xml +++ b/appendices/migration71/incompatible.xml @@ -1,6 +1,6 @@ - + 不向后兼容的变更 @@ -9,9 +9,8 @@ 当传递参数过少时将抛出错误 - 在过去如果我们调用一个用户定义的函数时,提供的参数不足,那么将会产生一个警告(warning)。 - 现在,这个警告被提升为一个错误异常(Error exception)。这个变更仅对用户定义的函数生效, - 并不包含内置函数。例如: + 在过去如果我们调用一个用户定义的函数时,提供的参数不足,那么将会产生警告(warning)。现在,这个警告被提升为错误异常(Error + exception)。这个变更仅对用户定义的函数生效,并不包含内置函数。例如: @@ -156,25 +155,21 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d - Disallow the ASCII delete control character in identifiers + 禁止在标识符中使用 ASCII 删除控制字符 - The ASCII delete control character (0x7F) can no longer - be used in identifiers that are not quoted. + ASCII 删除控制字符(0x7F)不能用于未加引号的标识符中。 - <parameter>error_log</parameter> changes with <literal>syslog</literal> - value + <parameter>error_log</parameter> 更改为 <literal>syslog</literal> 值 - 如果 error_log ini 设置为 syslog,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. + 如果 error_log ini 设置为 syslog,PHP 错误等级会映射到 syslog + 错误级别。这在错误日志中带来了更好的区分,与之前相反,之前所有的错误只记录了错误级别。 @@ -195,8 +190,8 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d call_user_func 现在在调用一个以引用作为参数的函数时将始终产生一个警告。先前这取决于这个调用行为是否完全符合条件。 - 此外, call_user_func 和 - call_user_func_array 在这种情况下将不再中断函数调用。现在会出现一个包含"expected reference"的警告信息,但函数调用将正常进行。 + 此外,call_user_func 和 + call_user_func_array 在这种情况下将不再中断函数调用。现在会出现包含“expected reference”的警告信息,但函数调用将正常进行。 @@ -206,16 +201,15 @@ Warning: Cannot call func_num_args() dynamically in %s on line %d - 对字符串使用一个空索引操作符(例如$str[] = $x)将会抛出一个致命错误, - 而不是静默地将其转为一个数组。 + 对字符串使用一个空索引操作符(例如$str[] = $x)将会抛出一个致命错误,而不是静默地将其转为一个数组。 - ini配置项移除 + ini 配置项移除 - 下列ini配置项已经被移除: + 下列 ini 配置项已经被移除: @@ -421,11 +415,11 @@ new DateTime() == new DateTime(); - Lexically bound variables cannot reuse names + 词法绑定变量不能重用名字 通过 use 构造绑定到 closure - 的变量不能使用与任何 &link.superglobals;、$this 或任何参数相同的名称。 例如,所有这些函数定义都会导致致命错误: + 的变量不能使用与任何 &link.superglobals;、$this 或任何参数相同的名称。例如,所有这些函数定义都会导致致命错误: - Forbid "return;" for typed returns already at compile-time + 在编译时禁止 "return;" 用于类型化返回 - Return statements without argument in functions which declare a return type - now trigger E_COMPILE_ERROR (unless the return type is - declared as void), even if the return statement would never be - reached. + 在声明返回类型的函数中,没有参数的 return 语句现在触发 E_COMPILE_ERROR(除非返回类型声明为 + void),即使永远不会到达 return 语句。 diff --git a/appendices/migration80.xml b/appendices/migration80.xml index da3c52918..1bb3ffc0e 100644 --- a/appendices/migration80.xml +++ b/appendices/migration80.xml @@ -12,10 +12,8 @@ - 新的主版本号带来了一些 - 新特性 和 - 不兼容处, - 在生产环境上切换 PHP 版本前需要做测试。 + 新的主版本号带来了一些新特性和不兼容处,在生产环境上切换 PHP 版本前需要做测试。 diff --git a/appendices/migration80/incompatible.xml b/appendices/migration80/incompatible.xml index cd1f7443d..5675b14fd 100644 --- a/appendices/migration80/incompatible.xml +++ b/appendices/migration80/incompatible.xml @@ -19,9 +19,9 @@ - Comparison - Before - After + 比较 + 之前 + 之后 @@ -73,7 +73,7 @@ - 断言(Assertion)失败现在默认抛出异常。如果想要改回之前的行为,可以在 INI 设置中设置 + 断言(Assertion)失败现在默认抛出异常。如果想要改回之前的行为,可以在 INI 设置中设置 assert.exception=0 @@ -85,14 +85,13 @@ - 与类名相同的方法名将不再被当做构造方法。应该使用__construct() + 与类名相同的方法名将不再被当做构造方法。应该使用 __construct() 来取代它。 - 不再允许通过静态调用的方式去调用非静态方法。因此is_callable在检查一个类名与非静态方法 - 时将返回失败(应当检查一个类的实例)。 + 不再允许通过静态调用的方式去调用非静态方法。因此 is_callable 在检查一个类名与非静态方法时将返回失败(应当检查一个类的实例)。 @@ -319,7 +318,7 @@ function test(int $arg = null) {} - 编译时 fatal error“Only variables can be passed by reference”已延迟到运行时,并转换为“Argument cannot be passed by reference”Error异常。 + 编译时 fatal error“Only variables can be passed by reference”已延迟到运行时,并转换为“Argument cannot be passed by reference”Error 异常。 @@ -466,72 +465,60 @@ $array["key"]; - If an object constructor exits, the object destructor will no longer be - called. This matches the behavior when the constructor throws. + 如果对象的构造方法 exit,那么将不再调用对象的析构方法,这与构造方法抛出异常时的行为相匹配。 - Namespaced names can no longer contain whitespace: While Foo\Bar will be recognized - as a namespaced name, Foo \ Bar will not. Conversely, reserved keywords are now - permitted as namespace segments, which may also change the interpretation of code: - new\x is now the same as constant('new\x'), not - new \x(). + 命名空间名不能再包含空格:Foo\Bar 将识别为命名空间名称,而 Foo \ Bar + 则不能。相反,保留关键字现在允许作为命名空间片段,这可能也会改变代码的解释:new\x 现在与 + constant('new\x') 相同,而不是 new \x() - Nested ternaries now require explicit parentheses. + 嵌套的三元表达式现在需要的括号。 - debug_backtrace and Exception::getTrace will no - longer provide references to arguments. It will not be possible to change function arguments - through the backtrace. + debug_backtraceException::getTrace 将不再提供对参数的引用。通过回溯将不可能更改函数参数。 - Numeric string handling has been altered to be more intuitive and less error-prone. Trailing - whitespace is now allowed in numeric strings for consistency with how leading whitespace is - treated. This mostly affects: + 数字字符串的处理方式已经更改,以便更直观和更少出错。现在允许在数字字符串中使用尾随空格,以便与起始空格的处理方式保持一致。这主要影响: - The is_numeric function - String-to-string comparisons - Type declarations - Increment and decrement operations + is_numeric 函数 + 字符串间的比较 + 类型声明 + 递增/减操作 - The concept of a "leading-numeric string" has been mostly dropped; the cases where this remains - exist in order to ease migration. Strings which emitted an E_NOTICE "A non - well-formed numeric value encountered" will now emit an E_WARNING "A - non-numeric value encountered" and all strings which emitted an E_WARNING "A - non-numeric value encountered" will now throw a - TypeError. This mostly affects: + “前置数字字符串”的概念已删除大部分;仍然存在的目的是为了简化迁移。发出 E_NOTICE“A non well-formed numeric value + encountered”的字符串现在将发出 E_WARNING“A non-numeric value encountered”,并且所有发出 + E_WARNING“A non-numeric value encountered”的字符串现在将抛出 TypeError。这主要会影响: - Arithmetic operations - Bitwise operations + 算术运算 + 位运算 - This E_WARNING to TypeError change also affects the - E_WARNING "Illegal string offset 'string'" for illegal string offsets. The - behavior of explicit casts to int/float from strings has not been changed. + E_WARNINGTypeError 的变更也影响了 E_WARNING“Illegal string + offset 'string'”的非法字符串偏移。从字符串到 int/float 的明确强制转换的行为没有改变。 - Magic Methods will now have their arguments and return types checked if they have them declared. - The signatures should match the following list: + 如果魔术方法声明了参数和返回类型,那么它们现在将会检查这些。签名应该与以下列表匹配: @@ -555,16 +542,13 @@ $array["key"]; - call_user_func_array array keys will now be interpreted as parameter names, - instead of being silently ignored. + call_user_func_array 数组的键现在将解释为参数名,而不是默默忽略。 - Declaring a function called assert() inside a namespace is - no longer allowed, and issues E_COMPILE_ERROR. - The assert function is subject to special handling by the engine, - which may lead to inconsistent behavior when defining a namespaced function with the same name. + 不再允许在命名空间内声明名为 assert() 的函数,并发出 E_COMPILE_ERRORassert + 函数受引擎的特殊处理,当定义具有相同名称的命名空间函数时,可能会导致不一致的行为。 @@ -572,156 +556,130 @@ $array["key"]; - Resource to Object Migration + 迁移资源到对象 - Several &resource;s have been migrated to &object;s. - Return value checks using is_resource should be replaced with checks for &false;. + 一些 &resource; 已经迁移到了 &object;。返回值检测从使用 is_resource 替换为是否是 &false;。 - curl_init will now return a CurlHandle object rather - than a &resource;. The curl_close function no longer has an effect, - instead the CurlHandle instance is automatically destroyed if it is no - longer referenced. + curl_init 现在将返回 CurlHandle 对象而不是 &resource;。curl_close + 函数不再有作用,相反,如果不再引用,CurlHandle 实例将自动销毁。 - curl_multi_init will now return a CurlMultiHandle - object rather than a &resource;. The curl_multi_close function no - longer has an effect, instead the CurlMultiHandle instance is - automatically destroyed if it is no longer referenced. + curl_multi_init 现在将返回 CurlMultiHandle 对象而不是 &resource;。curl_multi_close + 函数不再有作用,相反,如果不再引用,CurlMultiHandle 实例将自动销毁。 - curl_share_init will now return a CurlShareHandle - object rather than a &resource;. The curl_share_close function no - longer has an effect, instead the CurlShareHandle instance is - automatically destroyed if it is no longer referenced. + curl_share_init 现在将返回 CurlShareHandle 对象而不是 &resource;。curl_share_close + 函数不再有作用,相反,如果不再引用,CurlShareHandle 实例将自动销毁。 - enchant_broker_init will now return an EnchantBroker - object rather than a &resource;. + enchant_broker_init 现在将返回 EnchantBroker 对象而不是 &resource;。 - enchant_broker_request_dict and - enchant_broker_request_pwl_dict will now return an - EnchantDictionary object rather than a &resource;. + enchant_broker_request_dict 和 + enchant_broker_request_pwl_dict 现在将返回 + EnchantDictionary 对象而不是 &resource;。 - The GD extension now uses GdImage objects as the underlying data structure - for images, rather than &resource;s. - The imagedestroy function no longer has an effect; instead the - GdImage instance is automatically destroyed if it is no longer referenced. + GD 扩展现在使用 GdImage 对象作为图像的底层数据结构,而不是 &resource;。imagedestroy + 函数不再有作用,相反,如果不再引用,GdImage 实例将自动销毁。 - openssl_x509_read and openssl_csr_sign will now return - an OpenSSLCertificate object rather than a &resource;. - The openssl_x509_free function is deprecated and no longer has an effect, - instead the OpenSSLCertificate instance is automatically destroyed if it - is no longer referenced. + openssl_x509_readopenssl_csr_sign 现在将返回 OpenSSLCertificate + 对象而不是 &resource;。弃用 openssl_x509_free 函数且不再起作用,相反,如果不再引用,OpenSSLCertificate + 实例将自动销毁。 - openssl_csr_new will now return an - OpenSSLCertificateSigningRequest object rather than a &resource;. + openssl_csr_new 现在将返回 + OpenSSLCertificateSigningRequest 对象而不是 &resource;。 - openssl_pkey_new will now return an - OpenSSLAsymmetricKey object rather than a &resource;. - The openssl_pkey_free function is deprecated and no longer has an effect, - instead the OpenSSLAsymmetricKey instance is automatically destroyed if it - is no longer referenced. + openssl_pkey_new 现在将返回 OpenSSLAsymmetricKey 对象而不是 &resource;。弃用 + openssl_pkey_free 函数且不再起作用,相反,如果不再引用,OpenSSLAsymmetricKey + 实例将自动销毁。 - shmop_open 现在将返回 Shmop 对象而不是 - &resource;。shmop_close 函数将不再有效,已弃用;如果不在引用 - Shmop 实例,其将会自动销毁。 + shmop_open 现在将返回 Shmop 对象而不是 &resource;。弃用 + shmop_close 函数且不再起作用,相反,如果不再引用,Shmop 实例将自动销毁。 - socket_create, socket_create_listen, - socket_accept, socket_import_stream, - socket_addrinfo_connect, socket_addrinfo_bind, and - socket_wsaprotocol_info_import will now return a - Socket object rather than a &resource;. - socket_addrinfo_lookup will now return an array of - AddressInfo objects rather than &resource;s. + socket_createsocket_create_listensocket_acceptsocket_import_streamsocket_addrinfo_connectsocket_addrinfo_bind + 和 socket_wsaprotocol_info_import 现在将返回 Socket 对象而不是 + &resource;。socket_addrinfo_lookup 现在将返回 AddressInfo 对象组成的数组,而不是 &resource;。 - msg_get_queue will now return an SysvMessageQueue - object rather than a &resource;. + msg_get_queue 现在将返回 SysvMessageQueue + 对象而不是 &resource;。 - sem_get will now return an SysvSemaphore object - rather than a &resource;. + sem_get 现在将返回 SysvSemaphore + 对象而不是 &resource;。 - shm_attach will now return an SysvSharedMemory object - rather than a &resource;. + shm_attach 现在将返回 SysvSharedMemory + 对象而不是 &resource;。 - xml_parser_create and xml_parser_create_ns will now - return an XMLParser object rather than a &resource;. The - xml_parser_free function no longer has an effect, instead the XmlParser - instance is automatically destroyed if it is no longer referenced. + xml_parser_createxml_parser_create_ns 现在将返回 XMLParser + 对象而不是 &resource;。xml_parser_free 函数不再有作用,相反,如果不再引用,XmlParser 实例将自动销毁。 - The XMLWriter functions now accept and return, respectively, - XMLWriter objects instead of &resource;s. + XMLWriter 函数现在分别接受和返回 XMLWriter 对象而不是 &resource;。 - inflate_init will now return an InflateContext object - rather than a &resource;. + inflate_init 现在将返回 InflateContext 对象而不是 &resource;。 - deflate_init will now return a DeflateContext object - rather than a &resource;. + deflate_init 现在将返回 DeflateContext 对象而不是 &resource;。 - COM and .Net (Windows) + COM 和 .Net (Windows) - The ability to import case-insensitive constants from type libraries has been removed. - The second argument to com_load_typelib may no longer be false; - com.autoregister_casesensitive - may no longer be disabled; case-insensitive markers in - com.typelib_file are ignored. + 移除从类型库导入不区分大小写常量的功能。com_load_typelib 的第二个参数不再是 false;不再禁用 com.autoregister_casesensitive;忽略 com.typelib_file 中的不区分大小写标记。 diff --git a/appendices/migration80/new-features.xml b/appendices/migration80/new-features.xml index b7df42e69..7ff9ff0fd 100644 --- a/appendices/migration80/new-features.xml +++ b/appendices/migration80/new-features.xml @@ -33,8 +33,7 @@ 构造器属性提升(Constructor Property Promotion) - 新增构造器属性提升功能 - 在构造函数中声明类的属性)。 + 新增对构造器属性提升(在构造函数中声明类的属性)的支持。 @@ -43,13 +42,13 @@ 联合类型 - 新增 联合类型。 + 新增联合类型。 - Match 表达式 + match 表达式 新增 match 表达式。 @@ -61,7 +60,7 @@ Nullsafe 运算符 - 新增Nullsafe 运算符(?->)。 + 新增 Nullsafe 运算符(?->)。 @@ -83,8 +82,7 @@ - 现在,只要类型兼容,任意数量的函数参数都可以用一个可变参数替换。 - 例如允许编写下面的代码: + 现在,只要类型兼容,任意数量的函数参数都可以用一个可变参数替换。例如允许编写下面的代码: @@ -103,7 +101,7 @@ class B extends A { - static ("后期静态绑定"中) 可以作为返回类型: + static(“后期静态绑定”中)可以作为返回类型: @@ -128,8 +126,7 @@ class Test { - &new;、&instanceof; 可用于任何表达式, - 用法为 new (expression)(...$args)$obj instanceof (expression)。 + &new;、&instanceof; 可用于任何表达式,用法为 new (expression)(...$args)$obj instanceof (expression) @@ -142,22 +139,19 @@ class Test { - 添加 Stringable interface, - 当一个类定义 __toString() 方法后会自动实现该接口。 + 添加 Stringable interface,当类定义 __toString() 方法后会自动实现该接口。 - Trait 可以定义私有抽象方法(abstract private method)。 - 类必须实现 trait 定义的该方法。 + Trait 可以定义私有抽象方法(abstract private method)。类必须实现 trait 定义的该方法。 - 可作为表达式使用 throw。 - 使得可以编写以下用法: + 可作为表达式使用 throw。使得可以编写以下用法: - 现在允许 catch (Exception) 一个 exception 而无需捕获到变量中。 + 现在允许 catch (Exception) exception 而无需捕获到变量中。 @@ -198,7 +192,7 @@ function functionWithLongSignature( - 父类中声明的私有方法不在对子类中的方法执行任何继承规则(final private 构造函数除外)。下列示例说明删除了那些限制: + 父类中声明的私有方法不在对子类中的方法执行任何继承规则(final private 构造方法除外)。下列示例说明删除了那些限制: openssl_cms_sign 使用证书和密钥对文件中的 MIME 消息进行签名,并将结果输出到提供的文件。 - openssl_cms_verify that verifies that the data block is intact, the signer - is who they say they are, and returns the certs of the signers. + openssl_cms_verify 用于验证数据块是否完好无损,签名者是否是声称的那个人,然后返回签名者的证书。 @@ -460,7 +453,7 @@ $proc = proc_open($command, [['pty'], ['pty'], ['pty']], $pipes); - proc_open 现在支持套接字对描述符。以下将独立的套接字对附加到stdinstdout + proc_open 现在支持套接字对描述符。以下将独立的套接字对附加到 stdinstdoutstderr diff --git a/appendices/migration80/other-changes.xml b/appendices/migration80/other-changes.xml index 187e6aa93..c8082dba5 100644 --- a/appendices/migration80/other-changes.xml +++ b/appendices/migration80/other-changes.xml @@ -69,13 +69,10 @@ - ZipArchive::addEmptyDirZipArchive::addFile、 - ZipArchive::addFromString + ZipArchive::addEmptyDirZipArchive::addFileZipArchive::addFromString 方法新增 flags 参数。 - 可用于名称编码 - (ZipArchive::FL_ENC_*) 与条目(entry)替换 - (ZipArchive::FL_OVERWRITE)。 + 可用于名称编码(ZipArchive::FL_ENC_*)与条目(entry)替换(ZipArchive::FL_OVERWRITE)。 @@ -111,8 +108,8 @@ 日期/时间 - 现在 DatePeriod 实现(implements)了 IteratorAggregate - (之前是 Traversable)。 + 现在 DatePeriod 实现(implements)了 IteratorAggregate(之前是 + Traversable)。 @@ -121,8 +118,8 @@ 现在 DOMNamedNodeMapDOMNodeList 实现(implements)了 - IteratorAggregate (之前是 - Traversable)。 + IteratorAggregate(之前是 + Traversable)。 @@ -131,7 +128,7 @@ 现在 IntlBreakIteratorResourceBundle 实现(implements)了 - IteratorAggregate (之前是 Traversable)。 + IteratorAggregate(之前是 Traversable)。 @@ -139,8 +136,7 @@ Enchant - 现在环境允许时,enchant 会默认使用 libenchant-2。 - 仍然支持 libenchant 1,但已经废弃,并将在未来移除。 + 现在环境允许时,enchant 会默认使用 libenchant-2。仍然支持 libenchant 1,但已经废弃,并将在未来移除。 @@ -150,11 +146,8 @@ - imagepolygon、 - imageopenpolygonimagefilledpolygon - 的参数 num_points 现在为可选参数。 - 这些函数可用三或四个参数去调用。 - 省略参数时,会按 count($points)/2 计算。 + imagepolygonimageopenpolygonimagefilledpolygon + 的参数 num_points 现在为可选参数。这些函数可用三或四个参数去调用。省略参数时,会按 count($points)/2 计算。 @@ -195,20 +188,18 @@ LibXML - 现在要求 libxml 最小版本为 2.9.0。 - 这代表着确保了默认情况下禁用了外部实体加载(external entity loading)的功能。 - 无需额外步骤即可防范 XML 外部实体注入攻击(XXE attacks)。 + 现在要求 libxml 最小版本为 2.9.0。这代表着确保了默认情况下禁用了外部实体加载(external entity + loading)的功能。无需额外步骤即可防范 XML 外部实体注入攻击(XXE attacks)。 - MySQLi / PDO MySQL + MySQLi/PDO MySQL - 未使用 mysqlnd 时(也是默认且推荐的做法), - 支持的最小 libmysqlclient 版本为 5.5。 + 未使用 mysqlnd 时(也是默认且推荐的做法),支持的最小 libmysqlclient 版本为 5.5。 @@ -222,7 +213,7 @@ - PGSQL / PDO PGSQL + PGSQL/PDO PGSQL PGSQL 与 PDO PGSQL 扩展需要 libpq 的版本号至少为 9.1。 @@ -233,11 +224,8 @@ Readline - 在交互提示开始之前调用 readline_completion_function - (例如在 auto_prepend_file 中), - 将重写默认的交互输入补全函数。 - 之前,只有交互提示(interactive prompt)开始后, - readline_completion_function 才会运行。 + 在交互提示开始之前调用 readline_completion_function(例如在 auto_prepend_file + 中),将重写默认的交互输入补全函数。之前,只有交互提示(interactive prompt)开始后,readline_completion_function 才会运行。 @@ -247,8 +235,7 @@ 现在 SimpleXMLElement 实现(implements)了 RecursiveIterator 并吸收了 - SimpleXMLIterator 的功能。 - SimpleXMLIterator 是 + SimpleXMLIterator 的功能。SimpleXMLIteratorSimpleXMLElement 的一个空扩展。 @@ -287,21 +274,20 @@ - opcache 扩展新增了即时编译(JIT) 支持。 + opcache 扩展新增了即时编译(JIT)支持。 - array_slice 用于没有空隙的数组时, - 将不会扫描整个数组去查找开始的位移(offset)。 - 在 offset 较大、长度较小时,会显著减少函数的运行时间。 + array_slice 用于没有空隙的数组时,将不会扫描整个数组去查找开始的位移(offset)。在 + offset 较大、长度较小时,会显著减少函数的运行时间。 - 当本地化 LC_CTYPE"C" 时(也是默认值), - strtolower 会使用 SIMD 的实现。 + 当本地化 LC_CTYPE"C" + 时(也是默认值),strtolower 会使用 SIMD 的实现。 diff --git a/appendices/migration81/new-features.xml b/appendices/migration81/new-features.xml index 02237349f..77b306e99 100644 --- a/appendices/migration81/new-features.xml +++ b/appendices/migration81/new-features.xml @@ -52,8 +52,7 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] 现在可以在参数展开后为命名参数。 - 例如: - foo(...$args, named: $arg). + 例如:foo(...$args, named: $arg). @@ -61,9 +60,9 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] 文件上传新增 full-path 键 - 现在文件上传新增了额外的 full_path 键, - 这包含了上传文件的完整路径(不仅仅是返回路径中的文件名部分)。 - 这是为了与 “upload webkitdirectory” 结合使用。 + 现在文件上传新增了额外的 full_path + 键,这包含了上传文件的完整路径(不仅仅是返回路径中的文件名部分)。这是为了与 “upload + webkitdirectory” 结合使用。 @@ -81,7 +80,7 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] 纤程 - 新增功能详见 Fibers 。 + 新增功能详见 Fibers。 @@ -91,7 +90,7 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] 现在可调用闭包可以使用 myFunc(...) - 语法创建,与 Closure::fromCallable('myFunc') 效果一样。 + 语法创建,与 Closure::fromCallable('myFunc')效果一样。 @@ -120,7 +119,7 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] Never 类型 - 新增一个新的仅仅返回类型 &never;。它表示函数要么 + 新增新的唯一返回类型 &never;。它表示函数要么 exit ,要么抛出异常,要么不会终止。 @@ -142,17 +141,17 @@ $arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd'] Readonly 属性 - 详见 readonly 。 + 详见 readonly。 - Final 类常量 + final 类常量 详见 final - 常量修饰符。而且,接口常量默认可覆盖。。 + 常量修饰符。而且,接口常量默认可覆盖。 @@ -215,8 +214,8 @@ curl_setopt($curl, CURLOPT_POSTFIELDS, ['file' => $file]); 新增 openmetrics 数据格式。Prometheus 可以用它来获取 FPM 的监测指标。 - 动态进程管理模式下,新增 pm.max_spawn_rate 设置。该设置在动态模式下会更快生成初始数量的子进程。 - 默认值为 32 ,这在以前是硬编码值。 + 动态进程管理模式下,新增 pm.max_spawn_rate 设置。该设置在动态模式下会更快生成初始数量的子进程。默认值为 + 32 ,这在以前是硬编码值。 @@ -233,27 +232,26 @@ curl_setopt($curl, CURLOPT_POSTFIELDS, ['file' => $file]); Hash - 现在,下列函数 hash, - hash_file,和 hash_init - 新增一个额外的 options 参数, - 该参数作为特定数据传递给函数算法。 + 现在,下列函数 hashhash_file + 和 hash_init 新增一个额外的 options + 参数,该参数作为特定数据传递给函数算法。 MurmurHash3 - 新增对 MurmurHash3 (支持流)的支持。有以下形式提供: + 新增对 MurmurHash3(支持流)的支持。有以下形式提供: - murmur3a, 32-bit hash + murmur3a,32 位散列 - murmur3c, 128-bit hash for x86 + murmur3c,x86 的 128 位散列 - murmur3f, 128-bit hash for x64 + murmur3f,x64 的 128 位散列 @@ -270,8 +268,7 @@ echo $h, "\n"; ]]> - - seed 的有效值范围为 0 到系统定义的 UINT_MAX,通常是 4294967295 。 + seed 的有效值范围为 0 到系统定义的 UINT_MAX,通常是 4294967295 @@ -279,21 +276,20 @@ echo $h, "\n"; xxHash - 增加 xxHash 的支持。 - 有以下形式提供: + 增加 xxHash 的支持。有以下形式提供: - xxh32, 32-bit hash + xxh32,32 位散列 - xxh64, 64-bit hash + xxh64,64 位散列 - xxh3, 64-bit hash + xxh3,64 位散列 - xxh128, 128-bit hash + xxh128,128 位散列 @@ -309,7 +305,6 @@ echo $h, "\n"; ]]> - 使用秘钥可以通过键为 secretoptions 数组传递,例如: @@ -321,7 +316,6 @@ echo $h, "\n"; ]]> - 自定义秘钥的质量对生成的散列质量至关重要。强烈建议秘钥尽可能使用最高标准的熵。 @@ -366,8 +360,8 @@ $stmt->execute([1, $username]); 新方法 <methodname>mysqli_result::fetch_column</methodname> - 新增 mysqli_result::fetch_column 方法可以从结果集中获取单个标量值。 - 新方法接收 &integer; 类型、从 0 开始,可选的 column 参数,用于从指定行获取数据。 + 新增 mysqli_result::fetch_column 方法可以从结果集中获取单个标量值。新方法接收 + &integer; 类型、从 0 开始,可选的 column 参数,用于从指定行获取数据。 @@ -388,8 +382,8 @@ echo $result->fetch_column(); PDO - 新增 PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY 常量,可用于指定可加载的文件目录。 - 这个设置只在禁用 PDO::MYSQL_ATTR_LOCAL_INFILE 时才有意义,这种情况下允许加载任意的文件目录。 + 新增 PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY 常量,可用于指定可加载的文件目录。这个设置只在禁用 + PDO::MYSQL_ATTR_LOCAL_INFILE 时才有意义,这种情况下允许加载任意的文件目录。 @@ -397,8 +391,8 @@ echo $result->fetch_column(); PDO_SQLite - 现在已支持 SQLite 的 "file:" DSN 语法。 - 可用于指定额外的标志。该功能在已设置 open_basedir 的情况下不能使用。 + 现在已支持 SQLite 的 "file:" DSN + 语法。可用于指定额外的标志。该功能在已设置 open_basedir 的情况下不能使用。 POSIX - 新增 POSIX_RLIMIT_KQUEUESPOSIX_RLIMIT_NPTS 。 - 这些 rlimits 只在 FreeBSD 可用。 + 新增 POSIX_RLIMIT_KQUEUESPOSIX_RLIMIT_NPTS。这些 + rlimits 只在 FreeBSD 可用。 - Standard + 标准 现在 fputcsv 新增参数 - eol ,这个参数允许自定义数据的行尾值,默认值是 "\n" 。 + eol,这个参数允许自定义数据的行尾值,默认值是 "\n" @@ -434,7 +428,7 @@ new PDO('sqlite:file:path/to/sqlite.db?mode=ro') 现在 SplFileObject::fputcsv 新增参数 - eol ,这个参数允许自定义数据的结束位置,默认值保持不变,还是 "\n" 。 + eol,这个参数允许自定义数据的结束位置,默认值保持不变,还是 "\n" diff --git a/language-snippets.ent b/language-snippets.ent index 4a3734353..4e30abf47 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -754,7 +754,7 @@ DLL 文件从 PHP 文件夹复制到 Windows 系统目录也行,但不建议 -资源(resource)'> +resource'> foreach'> @@ -763,10 +763,10 @@ DLL 文件从 PHP 文件夹复制到 Windows 系统目录也行,但不建议 yield'> 上下文(context)的说明请参考手册中的 上下文(context)章节.'> +xmlns="http://docbook.org/ns/docbook" linkend="context">上下文(context)章节。'> -include_path搜索文件名。'> +include_path 中搜索文件名。'>