Project

General

Profile

Backport(バックポート) #3417

opMobileUserAgent::__construct() で E_STRICT エラーが発生する

Added by Youichi Kimura about 10 years ago. Updated about 10 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Target version:
Start date:
2013-09-24
Due date:
% Done:

100%


Description

Overview (現象)

opMobileUserAgent::__construct() には Net_UserAgent_Mobile::factory() を呼び出している箇所があるが、Net_UserAgent_Mobile は PHP4 の形式で書かれたクラスのため、静的メソッドとして呼び出される factory() メソッドに static キーワードが付与されていない。そのため、factory() を呼び出した時点で E_STRICT エラーが発生してしまう。

  protected function __construct()
  {
    require_once 'Net/UserAgent/Mobile.php';
    require_once 'Net/UserAgent/Mobile/NonMobile.php';

    self::$mobile = Net_UserAgent_Mobile::factory();
    if (self::$mobile instanceof Net_UserAgent_Mobile_Error)
    {   
      self::$mobile = new Net_UserAgent_Mobile_NonMobile('');
    }   
  }

Way to fix (修正内容)

Net_UserAgent_Mobile::factory() を使用しているのは opMobileUserAgent::_construct() 以外に無いため、factory() を呼び出す前後で一時的に E_STRICT エラーを error_reporting の値から外すことで回避する。


Related issues

Related to OpenPNE 3 - Bug(バグ) #3406: opMobileUserAgent::__construct() で E_STRICT エラーが発生する Won't fix(対応せず)

Associated revisions

Revision 13ad0fe4 (diff)
Added by Youichi Kimura about 10 years ago

ignore E_STRICT error for Net_UserAgent_Mobile::factory() (fixes #3417, BP from #3406)

(cherry picked from commit 5749159540e18f2af0e3bc5373f72a3ddeefe5c8)

History

#1 Updated by Youichi Kimura about 10 years ago

  • Parent task set to #3406

#2 Updated by Youichi Kimura about 10 years ago

  • Parent task deleted (#3406)

#3 Updated by Youichi Kimura about 10 years ago

  • Status changed from New(新規) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

更新履歴 13ad0fe4f478a34d0d9cacf2a6fca292744899e1 で適用されました。

#4 Updated by Shinichi Urabe about 10 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

レビューOKです

#5 Updated by Mutsumi Imamura about 10 years ago

  • Status changed from Pending Testing(テスト待ち) to Fixed(完了)
  • % Done changed from 70 to 100

./symfony test:all を実行し異常終了しないことを確認しました。

Also available in: Atom PDF