PHP 7 - Deprecated Features

Following features are deprecated and may be removed from future releases of PHP.

PHP 4 style constructors

PHP 4 style Constructors are methods having same name as the class they are defined in, are now deprecated, and will be removed in the future. PHP 7 will emit E_DEPRECATED if a PHP 4 constructor is the only constructor defined within a class. Classes implementing a __construct() method are unaffected.

Example

<?php
   class A {
      function A() {
         print('Style Constructor');
      }
   }
?>
It produces the following browser output −
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...

Static calls to non-static methods

Static calls to non-static methods are deprecated, and may be removed in the future.

Example

<?php
   class A {
      function b() {
         print('Non-static call');
      }
   }
   A::b();
?>
It produces the following browser output −
Deprecated: Non-static method A::b() should not be called statically in...
Non-static call

password_hash() salt option

The salt option for the password_hash() function has been deprecated so that the developers do not generate their own (usually insecure) salts. The function itself generates a cryptographically secure salt, when no salt is provided by the developer - thus custom salt generation is not required any more.

capture_session_meta SSL context option

The capture_session_meta SSL context option has been deprecated. SSL metadata is now used through the stream_get_meta_data() function.