/
incompatible.xml
206 lines (176 loc) · 9.54 KB
/
incompatible.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 97fb8392092c2e1cb4804a87422e3465c5ec2ca2 Maintainer: mowangjuanzi Status: ready -->
<!-- CREDITS: Luffy -->
<sect1 xml:id="migration83.incompatible" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>不向后兼容的变更</title>
<sect2 xml:id="migration83.incompatible.core">
<title>PHP 核心</title>
<sect3 xml:id="migration83.incompatible.core.overflowing-call-stack">
<title>调用栈非常接近溢出的程序</title>
<para>
当程序接近溢出调用栈时,如果使用超过 <!-- link linkend="zend.max_allowed_stack_size-zend.reserved_stack_size" -->zend.max_allowed_stack_size-zend.reserved_stack_size<!-- </link>-->
字节的栈空间(对于纤程则是 <!-- link linkend="fiber.stack_size-zend.reserved_stack_size" -->fiber.stack_size-zend.reserved_stack_size<!-- </link>-->),
可能会抛出一个 <classname>Error</classname>。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.proc-get-status-multiple-times">
<title>多次执行 proc_get_status()</title>
<para>
在 POSIX 系统上多次执行 <function>proc_get_status</function> 现在将始终返回正确的值。以前,函数只有在第一次调用时才会返回正确的值。<function>proc_get_status</function>
之后执行 <function>proc_close</function> 现在也会返回正确的退出码。之前会返回 <literal>-1</literal>。
在内部,这是通过缓存 POSIX 系统的结果实现的。如果需要之前的行为,可以检测 <function>proc_get_status</function>
返回数组中的 <literal>"cached"</literal> 键,以检查结果是否已经缓存。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.zend-max-execution-timers">
<title>Zend Max Execution Timers</title>
<para>
在 Linux 上,Zend Max Execution Timers 在 ZTS 编译中默认启用。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.traits-with-static-properties">
<title>使用带静态属性的 trait</title>
<para>
使用带静态属性的 trait 现在会重新声明从父类继承的静态属性。这将为当前类创建单独的静态属性存储。这与不使用
trait 而将静态属性直接添加到当前类中类似。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.negative-index-to-empty-array">
<title>赋值负数索引到空数组</title>
<para>
现在将负数索引 <varname>$n</varname> 赋值给空数组,将确保下一个索引为 <code>$n+1</code> 而不是 <literal>0</literal>。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.class-constant-visibility-check">
<title>类常量可见性差别检查</title>
<para>
从接口进行继承时,现在会正确的检查类常量的可见性差别。
</para>
</sect3>
<sect3 xml:id="migration83.incompatible.core.weakmap-entries-maps-to-itself">
<title>键映射到自身的 WeakMap 条目</title>
<para>
如果该键只能通过迭代 WeakMap(认为通过迭代可达是弱可达性)才能访问到,那么在循环回收期间,现在可以删除键映射到自身(可能是传递)的
<classname>WeakMap</classname> 条目。
</para>
</sect3>
</sect2>
<sect2 xml:id="migration83.incompatible.date">
<title>Date</title>
<para>
DateTime 扩展在 <classname>DateError</classname> 和 <classname>DateException</classname> 层次结构下引入了特定于
Date 扩展的 exception 和 error,而不是 warning 和通用 exception。这改善了错误处理,但需要检查 error 和 exception。
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.dom">
<title>DOM</title>
<para>
现在对于没有父节点的节点调用 <methodname>DOMChildNode::after</methodname>、<methodname>DOMChildNode::before</methodname>
和 <methodname>DOMChildNode::replaceWith</methodname> 时不会有任何操作,不会抛出层级结构异常,这是 DOM 规范要求的行为。
</para>
<para>
在没有文档的时候使用 <classname>DOMParentNode</classname> 和 <classname>DOMChildNode</classname>
方法可以正常工作,而不会抛出 <constant>DOM_HIERARCHY_REQUEST_ERR</constant>
<classname>DOMException</classname>。这与 DOM 规范要求的行为一致。
</para>
<para>
不带指定前缀就调用 <methodname>DOMDocument::createAttributeNS</methodname>
将错误的创建默认命名空间,并将元素放入到命名空间而不是元素中。这个错误现在已经修复。
</para>
<para>
当前缀已用于不同的 URI,<methodname>DOMDocument::createAttributeNS</methodname> 之前会错误的抛出
<constant>DOM_NAMESPACE_ERRNAMESPACE_ERR</constant>
<classname>DOMException</classname>。现在当前缀名称存在冲突时,将会正确的选择不同前缀。
</para>
<para>
为一些 DOM 类添加了新的方法和属性。如果用户空间类继承了这些类并声明了相同的属性和方法,则这些声明必须兼容。否则将会抛出典型的声明不兼容的编译错误。参阅<link
linkend="migration83.new-features.dom">新功能列表</link>和<link linkend="migration83.new-functions.dom">新函数</link>列表已获取新实现的方法和属性。
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.ffi">
<title>FFI</title>
<para>
当 C 函数有 <type>void</type> 返回类型时,现在返回 &null;,而不是返回对象 <literal>object(FFI\CData:void) { }</literal>
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.opcache">
<title>Opcache</title>
<para>
移除了 <link linkend="ini.opcache.consistency-checks">opcache.consistency_checks</link> INI 指令。此功能与 tracing JIT
以及继承缓存不兼容,自 PHP 8.1.18 和 PHP 8.2.5 起,已禁用此功能,无法启用。脚本持久化后,因其检验和无效,导致 tracing JIT
以及继承缓存会修改 shm。尝试修复可跳过的可修改指针,但由于复杂性而被拒绝。因此决定移除此功能。
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.phar">
<title>Phar</title>
<para>
<classname>Phar</classname> 类常量的类型现在已声明。
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.standard">
<title>标准</title>
<para>
<function>range</function> 函数已经进行了各种更改:
<simplelist>
<member>当传递 <type>object</type>、<type>resource</type> 或 <type>array</type> 作为边界输入时,现在会抛出 <classname>TypeError</classname>。</member>
<member>当传递 <literal>0</literal> 作为 <parameter>$step</parameter> 时,现在会抛出更具描述性的 <classname>ValueError</classname>。</member>
<member>使用负数 <parameter>$step</parameter> 作为自增范围时现在会抛出 <classname>ValueError</classname>。</member>
<member>如果 <parameter>$step</parameter> 可以解释为整数的浮点数,那么现在就可以这样做。</member>
<member>如果任意参数是无穷大或者 NAN,现在会抛出 <classname>ValueError</classname>。</member>
<member>如果 <parameter>$start</parameter> 或 <parameter>$end</parameter> 是空字符串,现在会触发
<constant>E_WARNING</constant>。值将会转换为 <literal>0</literal>。</member>
<member>如果 <parameter>$start</parameter> 或 <parameter>$end</parameter> 超过 1
字节时,仅当其为非数字字符串时,现在会触发 <constant>E_WARNING</constant>。</member>
<member>如果 <parameter>$start</parameter> 或 <parameter>$end</parameter> 因为其它边界输入是数字(例如
<code>range(5, 'z');</code>)导致强制转换为整数,现在会触发 <constant>E_WARNING</constant>。</member>
<member>当尝试生成字符范围时,如果 <parameter>$step</parameter> 时浮点数,除非两个边界输入都是输字符串(例如
<code>range('5', '9', 0.5);</code> 不会产生警告),否则会触发 <constant>E_WARNING</constant>。</member>
<member><function>number_format</function> 现在处理负的 <parameter>$decimals</parameter> 值,
通过将 <parameter>$num</parameter> 四舍五入到小数点前的 <code>abs($decimals)</code> 位。
以前,负的 <parameter>$decimals</parameter> 值会被忽略。</member>
<member>如果其中一个边界是数字字符串,另一个边界输入不转换为数字(例如 <code>range('9', 'A');</code>),现在
<function>range</function> 会生成字符列表。</member>
</simplelist>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
range('9', 'A'); // ["9", ":", ";", "<", "=", ">", "?", "@", "A"],自 PHP 8.3.0 起
range('9', 'A'); // [9, 8, 7, 6, 5, 4, 3, 2, 1, 0],PHP 8.3.0 之前
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
<function>file</function> flags 错误检查现在可以捕获所有无效的
flags。尤其是之前默默接受 <constant>FILE_APPEND</constant>。
</para>
</sect2>
<sect2 xml:id="migration83.incompatible.SNMP">
<title>SNMP</title>
<para>
<classname>SNMP</classname> 类常量的类型现在已声明。
</para>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->