Home>Article>Backend Development> php7.0.x deprecated features

php7.0.x deprecated features

L
L forward
2020-05-27 16:30:05 2876browse

php7.0.x deprecated features

Deprecated feature in php 7.0.x

PHP4-style constructors

PHP4-style constructors (method names are the same as class names) are deprecated and will be removed in the future. PHP7 will generate an E_DEPRECATED warning if only PHP4-style constructors are used in a class. If the __construct() method is also defined, it will not be affected.

The above routine will output:

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 call to non-static method

Abandoned Static call is not declared into a static method, this feature may be completely removed in the future.

The above routine will output:

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

password_hash() salt option

The salt option in the password_hash() function is obsolete. Prevent developers from generating their own salts (generally less secure). When the developer does not pass this value, the function itself will generate a cryptographically secure salt value. Therefore there is no need to pass in your own custom salt value.

capture_session_meta SSL context option

The SSL context option in capture_session_meta is obsolete. SSL metadata can now be obtained via stream_get_meta_data().

Deprecated in LDAP

The following functions have been deprecated:

ldap_sort()

Recommended Tutorial: "PHP7" "PHP Tutorial"

The above is the detailed content of php7.0.x deprecated features. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:php.net. If there is any infringement, please contact admin@php.cn delete