Make WordPress Core

Changeset 56224


Ignore:
Timestamp:
07/13/2023 12:56:19 AM (19 months ago)
Author:
peterwilsoncc
Message:

General: Update Opera browser sniff follow UA string changes.

Since switching to the Blink engine, Opera browsers contain both the strings Chrome and OPR\. This change relocates the Opera test to take place before the Chrome test to ensure the correct browser is detected.

Props brasofilo, desrosj, costdev, mukesh27, swissspidy.
Fixes #46132.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/vars.php

    r55990 r56224  
    7070    } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Edg' ) ) {
    7171        $is_edge = true;
     72    } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'OPR/' ) ) {
     73        $is_opera = true;
    7274    } elseif ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chrome' ) !== false ) {
    7375        if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
     
    9698    } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Gecko' ) ) {
    9799        $is_gecko = true;
    98     } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera' ) ) {
    99         $is_opera = true;
    100100    } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Nav' ) && str_contains( $_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.' ) ) {
    101101        $is_NS4 = true;
Note: See TracChangeset for help on using the changeset viewer.