PHP 7.0.x 棄用的功能

PHP4 風(fēng)格的構(gòu)造函數(shù)

PHP4 風(fēng)格的構(gòu)造函數(shù)(方法名和類名一樣)將被棄用,并在將來移除。 如果在類中僅使用了 PHP4 風(fēng)格的構(gòu)造函數(shù),PHP7 會產(chǎn)生 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

靜態(tài)調(diào)用非靜態(tài)的方法

廢棄了 靜態(tài)(Static) 調(diào)用未聲明成 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() 函數(shù)中的鹽值選項,阻止開發(fā)者生成自己的鹽值(通常更不安全)。 開發(fā)者不傳該值時,該函數(shù)自己會生成密碼學(xué)安全的鹽值。因此再無必要傳入自己自定義的鹽值。

capture_session_meta SSL 上下文選項

廢棄了 capture_session_meta 內(nèi)的 SSL 上下文選項。 現(xiàn)在可以通過 stream_get_meta_data() 獲取 SSL 元數(shù)據(jù)(metadata)。

LDAP 中的廢棄

以下函數(shù)已被廢棄: