Project

General

Profile

Backport(バックポート) #3418

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-10-04
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 1b365046 (diff)
Added by Youichi Kimura about 10 years ago

ignore E_STRICT error for Net_UserAgent_Mobile::factory() (fixes #3418, BP from #3406)
(cherry picked from commit 5749159540e18f2af0e3bc5373f72a3ddeefe5c8)

Revision b50aab8b
Added by Youichi Kimura about 10 years ago

Merge branches 't-3418', 't-3420', 't-3422', 't-3459', 't-3460', 't-3461', 't-3462', 't-3463', 't-3465' and 't-3471' into stable-3.8.x

History

#1 Updated by Akihiro KOBAYASHI about 10 years ago

  • Assignee changed from Youichi Kimura to Akihiro KOBAYASHI

#2 Updated by Akihiro KOBAYASHI about 10 years ago

  • Status changed from New(新規) to Accepted(着手)

#3 Updated by Akihiro KOBAYASHI about 10 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

https://github.com/openpne/OpenPNE3/pull/81
pullリクエストしました。

#4 Updated by Youichi Kimura about 10 years ago

更新履歴 1b365046497ef7b889a05cb07ea97a3d647dcb12 で適用されました。

#5 Updated by Youichi Kimura about 10 years ago

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

#6 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