PHP 8.3.4 Released!

PHP 7.0.x 弃用的功能

PHP 4 风格的构造函数

PHP 4 风格的构造函数(方法名和类名一样)将会弃用,并在将来移除。如果在类中仅使用了 PHP 4 风格的构造函数,PHP 7 会产生 E_DEPRECATED 警告。如果还定义了 __construct() 方法则不受影响。

<?php
class foo {
function
foo() {
echo
'I am the constructor';
}
}
?>

以上示例会输出:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example.php on line 3

静态调用非静态的方法

废弃了静态(Static)调用未声明 static 的方法,未来可能会彻底移除该功能。

<?php
class foo {
function
bar() {
echo
'I am not static!';
}
}

foo::bar();
?>

以上示例会输出:

Deprecated: Non-static method foo::bar() should not be called statically in - on line 8
I am not static!

password_hash() 盐值选项

废弃了 password_hash() 函数中的盐值选项,阻止开发者生成自己的盐值(通常更不安全)。开发者不传该值时,该函数自己会生成密码学安全的盐值。因此再无必要传入自己自定义的盐值。

capture_session_meta SSL 上下文选项

废弃了 capture_session_meta 内的 SSL 上下文选项。现在可以通过 stream_get_meta_data() 获取 SSL 元数据(metadata)。

LDAP 中的废弃

以下函数已被废弃:

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top