<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration72.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'migration72.deprecated.php',
    1 => 'PHP 7.2.x で推奨されなくなる機能',
    2 => 'PHP 7.2.x で推奨されなくなる機能',
  ),
  'up' => 
  array (
    0 => 'migration72.php',
    1 => 'PHP 7.1.x から PHP 7.2.x への移行',
  ),
  'prev' => 
  array (
    0 => 'migration72.incompatible.php',
    1 => '下位互換性のない変更点',
  ),
  'next' => 
  array (
    0 => 'migration72.other-changes.php',
    1 => 'その他の変更',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'appendices/migration72/deprecated.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration72.deprecated" class="sect1">
 <h2 class="title">PHP 7.2.x で推奨されなくなる機能</h2>

 <div class="sect2" id="migration72.deprecated.unquoted-strings">
  <h3 class="title">クオートしない文字列</h3>

  <p class="para">
   クオートしない文字列は、その名前のグローバル定数が定義されていない場合は単なる文字列という扱いになります。
   このとき、いままでは <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> が発生していました。
   PHP 7.2.x 以降は、<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> が発生するようになります。
   次のメジャーバージョンアップ後は <span class="classname"><a href="class.error.php" class="classname">Error</a></span> 例外が発生するようになります。
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">NONEXISTENT</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* 出力:<br />Warning: Use of undefined constant NONEXISTENT - assumed 'NONEXISTENT' (this will throw an Error in a future version of PHP) in %s on line %d<br />string(11) "NONEXISTENT"<br />*/</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect2" id="migration72.deprecated.png2wbmp-jpeg2wbmp">
  <h3 class="title"><span class="function"><a href="function.png2wbmp.php" class="function">png2wbmp()</a></span> および <span class="function"><a href="function.jpeg2wbmp.php" class="function">jpeg2wbmp()</a></span></h3>

  <p class="para">
   GD 拡張モジュールの <span class="function"><a href="function.png2wbmp.php" class="function">png2wbmp()</a></span> および <span class="function"><a href="function.jpeg2wbmp.php" class="function">jpeg2wbmp()</a></span>
   関数は非推奨となり、次のPHPのメジャーバージョンアップで削除される予定です。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.INTL_IDNA_VARIANT_2003-variant">
  <h3 class="title"><strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong> バリアント</h3>

  <p class="para">
   Intl 拡張モジュール では、<strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong> バリアントは非推奨になりました。
   これは <span class="function"><a href="function.idn-to-ascii.php" class="function">idn_to_ascii()</a></span> および <span class="function"><a href="function.idn-to-utf8.php" class="function">idn_to_utf8()</a></span> 関数の
   デフォルト値として現在使われています。PHP 7.4 ではこのデフォルト値が
   <strong><code><a href="intl.constants.php#constant.intl-idna-variant-uts46">INTL_IDNA_VARIANT_UTS46</a></code></strong> に変更される予定ですし、
   PHP の次のメジャーバージョンアップでは、 <strong><code><a href="intl.constants.php#constant.intl-idna-variant-2003">INTL_IDNA_VARIANT_2003</a></code></strong> が削除される予定です。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.__autoload-method">
  <h3 class="title"><span class="function"><a href="function.autoload.php" class="function">__autoload()</a></span> メソッド</h3>

  <p class="para">
   <span class="function"><a href="function.autoload.php" class="function">__autoload()</a></span>メソッドは非推奨になりました。なぜなら、この関数は 
   (autoloader をチェインできない点で) <span class="function"><a href="function.spl-autoload-register.php" class="function">spl_autoload_register()</a></span>
   に劣っていますし、これら2つの autoload のやり方には互換性がないからです。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.track_errors-and-php_errormsg">
  <h3 class="title">php.ini の <code class="parameter">track_errors</code> および <code class="literal">$php_errormsg</code> 変数</h3>

  <p class="para">
   php.ini で <code class="parameter">track_errors</code> の設定が有効になると、
   致命的でないエラーが起きた場合に、<code class="literal">$php_errormsg</code> 変数がローカルスコープに生成されます。
   このようなエラー情報を収集するのに望ましい方法は、<span class="function"><a href="function.error-get-last.php" class="function">error_get_last()</a></span> 関数を使うことなので
   この機能は非推奨になりました。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.create_function-function">
  <h3 class="title"><span class="function"><a href="function.create-function.php" class="function">create_function()</a></span> 関数</h3>

  <p class="para">
   (<span class="function"><a href="function.eval.php" class="function">eval()</a></span> 関数のラッパーなので) この関数にはセキュリティ上の問題があるため、非推奨になりました。
   好ましい代替は  <a href="functions.anonymous.php" class="link">無名関数</a> です。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.mbstringfunc_overload-ini-setting">
  <h3 class="title">php.ini の <code class="parameter">mbstring.func_overload</code></h3>

  <p class="para">
   この設定が有効になった環境で使われる、文字列ベースの関数の相互運用上の問題により、この設定は非推奨になりました。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.unset-cast">
  <h3 class="title"><code class="literal">(unset)</code> キャスト</h3>

  <p class="para">
   あらゆる値を (unset) キャストすると <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> になりますが、この余分な機能は非推奨になりました。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.parse_str-no-second-arg">
  <h3 class="title">第二引数を指定しないで <span class="function"><a href="function.parse-str.php" class="function">parse_str()</a></span> 関数を使う</h3>

  <p class="para">
   2番目の引数を指定しないで <span class="function"><a href="function.parse-str.php" class="function">parse_str()</a></span> 関数を使うと、
   これが使われた関数内部のシンボルテーブルを収集してしまいます。
   これはセキュリティ上の問題があるため、2番目の引数を指定しないで <span class="function"><a href="function.parse-str.php" class="function">parse_str()</a></span>
   を使うのは非推奨になりました。この関数の2番目の引数は、クエリストリングを配列に設定してくれる
   ので、常に設定すべきです。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.gmp_random-function">
  <h3 class="title"><span class="function"><a href="function.gmp-random.php" class="function">gmp_random()</a></span> 関数</h3>

  <p class="para">
   この関数は、外部に公開されていない、プラットフォーム依存のlimbサイズの範囲に基づいて
   ランダムな数を生成しています。このため、この関数は非推奨になりました。GMP 拡張モジュールを使って
   ランダムな数値を生成する望ましいやり方は、
   <span class="function"><a href="function.gmp-random-bits.php" class="function">gmp_random_bits()</a></span> および
   <span class="function"><a href="function.gmp-random-range.php" class="function">gmp_random_range()</a></span> を使うことです。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.each-function">
  <h3 class="title"><span class="function"><a href="function.each.php" class="function">each()</a></span>関数</h3>

  <p class="para">
   この関数は、通常の <code class="literal">foreach</code>よりもループが遅く、PHPそのものの変更に伴って
   実装上の問題を引き起こしたことから、非推奨になりました。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.assert-string-arg">
  <h3 class="title"><span class="function"><a href="function.assert.php" class="function">assert()</a></span>関数に文字列を渡す</h3>

  <p class="para">
   <span class="function"><a href="function.assert.php" class="function">assert()</a></span> で <span class="function"><a href="function.eval.php" class="function">eval()</a></span> させるには、この関数に文字列を渡す必要がありました。
   リモートからコードを実行される可能性があるので、この関数に文字列を渡すのは非推奨になりました。boolean 値を渡すのが
   お勧めです。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.errcontext-arg-of-error-handlers">
  <h3 class="title">エラーハンドラの <code class="literal">$errcontext</code> 引数</h3>

  <p class="para">
   <code class="literal">$errcontext</code> 引数には、エラーが起きた場所の全てのローカル変数
   が含まれています。これは使われることが少ないことと、PHP の内部的な最適化に問題を
   引き起こすため、非推奨になりました。エラーが起きた場所のローカル変数の情報を取得
   するには、デバッガを使うべきです。
  </p>
 </div>

 <div class="sect2" id="migration72.deprecated.read_exif_data-function">
  <h3 class="title"><span class="function"><a href="function.read-exif-data.php" class="function">read_exif_data()</a></span> 関数</h3>

  <p class="para">
   <span class="function"><a href="function.read-exif-data.php" class="function">read_exif_data()</a></span> 関数は非推奨になりました。
   代わりに <span class="function"><a href="function.exif-read-data.php" class="function">exif_read_data()</a></span> 関数を使ってください。
  </p>
 </div>

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