WordPress.org

Making WordPress.org

Changeset 5961


Ignore:
Timestamp:
09/24/2017 01:28:47 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Browse Happy API: Mark versions of Opera earlier than 12.18 as insecure.

Add Opera 12.18 user-agent string to test data.

Fixes #3161.

Location:
sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/browsers.php

    r5949 r5961  
    2020        'Chrome'            => '18', // Lowest version at the moment (mobile)
    2121        'Firefox'           => '16',
    22         'Opera'             => '12.11',
     22        'Opera'             => '12.18',
    2323        'Safari'            => '5',
    2424        'Internet Explorer' => '11',
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/parse.php

    r5953 r5961  
    126126    $data['current_version'] = get_browser_version_from_name( $data['name'] );
    127127    $data['upgrade']         = ( ! empty( $data['current_version'] ) && version_compare( $data['version'], $data['current_version'], '<' ) );
    128     $data['insecure']        = ( 'Internet Explorer' == $data['name'] && version_compare( $data['version'], '11', '<' ) );
     128
     129    if ( 'Internet Explorer' === $data['name'] && version_compare( $data['version'], '11', '<' ) ) {
     130        $data['insecure'] = true;
     131    } elseif ( 'Opera' === $data['name'] && version_compare( $data['version'], '12.18', '<' ) ) {
     132        $data['insecure'] = true;
     133    }
    129134
    130135    return $data;
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r5954 r5961  
    115115                'Windows Opera 11.01',
    116116            ],
     117            // #3161
     118            [
     119                'Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.18',
     120                'Windows Opera 12.18',
     121            ],
    117122            [
    118123                'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27',
     
    242247        if ( 'Internet Explorer' === $parsed['name'] && version_compare( $parsed['version'], '11', '<' ) ) {
    243248            $this->assertTrue( $parsed['insecure'] );
     249        } elseif ( 'Opera' === $parsed['name'] && version_compare( $parsed['version'], '12.18', '<' ) ) {
     250            $this->assertTrue( $parsed['insecure'] );
    244251        }
    245252    }
Note: See TracChangeset for help on using the changeset viewer.