Note that using Incrementing/Decrementing operators on string is legal
<?php
$str = "";
echo ++$str; // output: 1
?>
New E_WARNING
and E_NOTICE
errors
have been introduced when invalid strings are coerced using operators
expecting numbers (+
-
*
/
**
%
<<
>>
|
&
^
) or their
assignment equivalents. An E_NOTICE
is emitted when the
string begins with a numeric value but contains trailing non-numeric
characters, and an E_WARNING
is emitted when the string
does not contain a numeric value.
<?php
'1b' + 'something';
以上示例会输出:
Notice: A non well formed numeric value encountered in %s on line %d Warning: A non-numeric value encountered in %s on line %d
Previously, 3-octet octal string escape sequences would overflow silently.
Now, they will still overflow, but E_WARNING
will be
emitted.
<?php
var_dump("\500");
以上示例会输出:
Warning: Octal escape sequence overflow \500 is greater than \377 in %s on line %d string(1) "@"
$this
不一致的修正
Whilst $this
is considered a special variable in PHP, it
lacked proper checks to ensure it wasn't used as a variable name or
reassigned. This has now been rectified to ensure that
$this
cannot be a user-defined variable, reassigned to a
different value, or be globalised.
Session ID 将不再在生成时进行哈希。这一变化,会导致以下四个 ini 设置不再使用:
session.entropy_file
session.entropy_length
session.hash_function
session.hash_bits_per_character
并增加以下两个 ini 设置:
session.sid_length
- 定义会话 ID 的长度(为了向后兼容,默认为 32 个字符)
session.sid_bits_per_character
- 定义了每个字符的存储位数(即增加了会话
ID 中可使用的字符范围),为了向后兼容,默认为 4
precision
如果该值设置为 -1,则使用 dtoa mode 0。默认值仍然是 14。
serialize_precision
如果该值设置为 -1,则使用 dtoa mode 0。现在默认值使用 -1。
gd.jpeg_ignore_warning
此 php.ini 设置的默认值已更改为 1,因此默认情况下将忽略 libjpeg 警告。
opcache.enable_cli
此 php.ini 设置的默认值已在 PHP 7.1.2 中更改为 1(启用),并在 PHP 7.1.7 中更改回 0(禁用)。
现在只能使用 CSPRNG 生成会话 ID。