<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Deprecated features in PHP 7.0.x</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration70.new-features.html">New features</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration70.changed-functions.html">Changed functions</a></div> <div class="up"><a href="migration70.html">Migrating from PHP 5.6.x to PHP 7.0.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="migration70.deprecated" class="sect1"> <h2 class="title">Deprecated features in PHP 7.0.x</h2> <div class="sect2" id="migration70.deprecated.php4-constructors"> <h3 class="title">PHP 4 style constructors</h3> <p class="para"> PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated, and will be removed in the future. PHP 7 will emit <strong><code>E_DEPRECATED</code></strong> if a PHP 4 constructor is the only constructor defined within a class. Classes that implement a <span class="function"><strong>__construct()</strong></span> method are unaffected. </p> <div class="informalexample"> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">foo </span><span style="color: #007700">{<br /> function </span><span style="color: #0000BB">foo</span><span style="color: #007700">() {<br /> echo </span><span style="color: #DD0000">'I am the constructor'</span><span style="color: #007700">;<br /> }<br />}<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <p class="para">The above example will output:</p> <div class="example-contents screen"> <div class="cdata"><pre> 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 </pre></div> </div> </div> </div> <div class="sect2" id="migration70.deprecated.static-calls"> <h3 class="title">Static calls to non-static methods</h3> <p class="para"> <a href="language.oop5.static.html" class="link">Static</a> calls to methods that are not declared <strong class="command">static</strong> are deprecated, and may be removed in the future. </p> <div class="informalexample"> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">foo </span><span style="color: #007700">{<br /> function </span><span style="color: #0000BB">bar</span><span style="color: #007700">() {<br /> echo </span><span style="color: #DD0000">'I am not static!'</span><span style="color: #007700">;<br /> }<br />}<br /><br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">::</span><span style="color: #0000BB">bar</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <p class="para">The above example will output:</p> <div class="example-contents screen"> <div class="cdata"><pre> Deprecated: Non-static method foo::bar() should not be called statically in - on line 8 I am not static! </pre></div> </div> </div> </div> <div class="sect2" id="migration70.deprecated.pwshash-salt-option"> <h3 class="title"><span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> salt option</h3> <p class="para"> The salt option for the <span class="function"><a href="function.password-hash.html" class="function">password_hash()</a></span> function has been deprecated to prevent developers from generating their own (usually insecure) salts. The function itself generates a cryptographically secure salt when no salt is provided by the developer - therefore custom salt generation should not be needed. </p> </div> <div class="sect2" id="migration70.deprecated.capture-session-meta"> <h3 class="title"><em>capture_session_meta</em> SSL context option</h3> <p class="para"> The <em>capture_session_meta</em> SSL context option has been deprecated. SSL metadata is now available through the <span class="function"><a href="function.stream-get-meta-data.html" class="function">stream_get_meta_data()</a></span> function. </p> </div> <div class="sect2" id="migration70.deprecated.ldap"> <h3 class="title"><a href="book.ldap.html" class="link">LDAP</a> deprecations</h3> <p class="simpara"> The following function has been deprecated: </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <span class="function"><a href="function.ldap-sort.html" class="function">ldap_sort()</a></span> </span> </li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration70.new-features.html">New features</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration70.changed-functions.html">Changed functions</a></div> <div class="up"><a href="migration70.html">Migrating from PHP 5.6.x to PHP 7.0.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>