<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration70.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'migration70.deprecated.php',
    1 => 'PHP 7.0.x 弃用的功能',
    2 => 'PHP 7.0.x 弃用的功能',
  ),
  'up' => 
  array (
    0 => 'migration70.php',
    1 => '从 PHP 5.6.x 移植到 PHP 7.0.x',
  ),
  'prev' => 
  array (
    0 => 'migration70.new-features.php',
    1 => '新特性',
  ),
  'next' => 
  array (
    0 => 'migration70.changed-functions.php',
    1 => '变更的函数',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'appendices/migration70/deprecated.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration70.deprecated" class="sect1">
 <h2 class="title">PHP 7.0.x 弃用的功能</h2>


 

 <div class="sect2" id="migration70.deprecated.php4-constructors">
  <h3 class="title">PHP 4 风格的构造函数</h3>

  <p class="para">
   PHP 4 风格的构造函数（方法名和类名一样）将会弃用，并在将来移除。如果在类中仅使用了
   PHP 4 风格的构造函数，PHP 7 会产生 <strong><code><a href="errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong> 警告。如果还定义了
   <span class="function"><strong>__construct()</strong></span> 方法则不受影响。
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?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">?&gt;</span></span></code></div>
   </div>

   <p class="para">以上示例会输出：</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">静态调用非静态的方法</h3>

  <p class="para">
   废弃了<a href="language.oop5.static.php" class="link">静态（Static）</a>调用未声明 <strong class="command">static</strong> 的方法，未来可能会彻底移除该功能。
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?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">?&gt;</span></span></code></div>
   </div>

   <p class="para">以上示例会输出：</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.php" class="function">password_hash()</a></span> 盐值选项</h3>

  <p class="para">
   废弃了 <span class="function"><a href="function.password-hash.php" class="function">password_hash()</a></span> 函数中的盐值选项，阻止开发者生成自己的盐值（通常更不安全）。开发者不传该值时，该函数自己会生成密码学安全的盐值。因此再无必要传入自己自定义的盐值。
  </p>
 </div>
 
 <div class="sect2" id="migration70.deprecated.capture-session-meta">
  <h3 class="title"><code class="literal">capture_session_meta</code> SSL 上下文选项</h3>

  <p class="para">
   废弃了 <code class="literal">capture_session_meta</code> 内的 SSL 上下文选项。现在可以通过
   <span class="function"><a href="function.stream-get-meta-data.php" class="function">stream_get_meta_data()</a></span> 获取 SSL 元数据（metadata）。
  </p>
 </div>
 
 <div class="sect2" id="migration70.deprecated.ldap">
  <h3 class="title"><a href="book.ldap.php" class="link">LDAP</a> 中的废弃</h3>
   <p class="simpara">
    以下函数已被废弃：
   </p>

   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      <span class="function"><a href="function.ldap-sort.php" class="function">ldap_sort()</a></span>
     </span>
    </li>
   </ul>
 </div>

</div><?php manual_footer($setup); ?>