Project

General

Profile

Actions

Backport(バックポート) #3417

closed

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

Added by Youichi Kimura over 11 years ago. Updated over 11 years ago.

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

100%

Estimated time:

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 1 (0 open1 closed)

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

Actions
Actions

Also available in: Atom PDF