block-quote On this pagechevron-down
copy Copy chevron-down
PHP 7.1.x 新特性 补充*其他的变更 参考:Other changesarrow-up-right
使用无效字符串进行算术的注意和警告
引入了新的E_WARNING和E_NOTICE错误时无效的字符串强制使用运营商预计数字(+ - * / * * % < < > > | & ^)或其等价物。当字符串以数字值开始时,会发出一个E_NOTICE,但是它包含后面的非数值字符,当字符串不包含数值时,会发出一个E_WARNING。
Copy <?php
'1b' + 'something'; 以上例程会输出:
Copy Notice: A non well formed numeric value encountered in %s on line %d 以前,3 octet的八进制字符串转义序列将会悄无声息地溢出。现在,它们仍然会溢出,但E_WARNING将被发出。
Copy <? php
var_dump ( " \500 " ); 以上例程会输出:
Copy Warning: Octal escape sequence overflow \500 is greater than \377 in %s on line %d
string(1) "@" 矛盾解决$this
尽管$this被认为是PHP中的一个特殊变量,但是它缺少适当的检查来确保它不用作变量名或重新分配。现在已经纠正了这一点,以确保$ This不能是用户定义的变量,重新分配给不同的值,或者是全球化的。
会话id将不再被哈希生成。有了这一变化,就会导致以下4个ini设置的删除:
session.hash_bits_per_character
加上以下两个ini设置:
session.sid_length- 定义会话ID的长度,默认为向后兼容的32个字符
session.sid_bits_per_character- 定义每个字符存储的比特数(即增加可以在会话ID中使用的字符的范围),默认为4以支持向后兼容.
精度(precision)
如果值设置为- 1,则使用dtoa模式0。默认值仍然是14。
serialize_precision
如果值设置为- 1,则使用dtoa模式0。值- 1现在默认使用。
gd.jpeg_ignore_warning
这个php的默认值。ini设置已经更改为1,因此默认的libjpeg警告将被忽略。
opcache.enable_cli
这个php的默认值。在PHP 7.1.2中,ini设置已经更改为1(启用)。
只使用CSPRNG的会话ID生成
会话id现在只能用CSPRNG生成。
当允许NULL时,更多的信息类型错误消息
TypeError exceptions for arg_info type checks will now provide more informative error messages. If the parameter type or return type acceptsNULL(by either having a default value ofNULLor being a nullable type), then the error message will now mention this with a message of "must be ... or null" or "must ... or be null."