Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11080

Send statistical information: user_agent: Version not accurate for (at least) Opera

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • 3.0.15-RC1
    • 3.0.11
    • ACP
    • None
    • PHP 5.3.8

      In /includes/questionnaire/questionnaire.php the user agent is recognized as:

      			if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match))
      			{
      $aMatchOpera ) ) $match[2]= $aMatchOpera[1];
      				$result['user_agent'] = $match[1] . ' ' . $match[2];
      				break;
      			}


      However, this will always bring up Opera/9.80 for Opera browsers although the version is higher for many years already. A typical user agent for Opera is:

      Opera/9.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.01


      So a more accurate code would be to pull the version component for the statistics:

      			if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match))
      			{
      				if( preg_match( '#opera/[0-9].+version/([0-9.]*)#i', $user_agent, $aMatchOpera ) ) $match[2]= $aMatchOpera[1];
      				$result['user_agent'] = $match[1] . ' ' . $match[2];
      				break;
      			}

            CHItA CHItA
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: