PHP 7 Deprecated Features
PHP4 Style Constructors
In PHP4, functions within a class could have the same name as the class, a feature that is deprecated in PHP7 and results in an E_DEPRECATED error. An E_DEPRECATED error is generated when the method name is the same as the class name, the class is not in a namespace, and the PHP5 constructor (__construct) does not exist.
Example
Example
<?php
class A {
function A() {
print('Style Constructor');
}
}
?>
The above program outputs:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in...
Calling Non-static Methods Statically
Calling non-static methods statically is no longer supported:
Example
Example
<?php
class A {
function b() {
print('Non-static call');
}
}
A::b();
?>
The above program outputs:
Deprecated: Non-static method A::b() should not be called statically in...
Non-static call
password_hash() Salt Option
The function no longer requires a salt to be provided by the developer. The function has built-in salt capabilities and does not require a developer-provided salt value.
capture_session_meta SSL Context Option
The "capture_session_meta" SSL context option is deprecated. Encrypted metadata related to active stream resources can be accessed via the return value of stream_get_meta_data().