Making WordPress.org

Opened 8 years ago

Closed 7 years ago

#2587 closed defect (bug) (fixed)

Update browse-happy

Reported by: azaozz's profile azaozz Owned by: otto42's profile Otto42
Milestone: Priority: high
Component: API Keywords: has-patch commit
Cc:

Description

Follow up from https://core.trac.wordpress.org/ticket/40165.

MS discontinued support for IE8, 9, 10 more than a year ago so these versions can be considered "insecure". We need to update the warnings shown on the Dashboard. They are coming from https://meta.trac.wordpress.org/browser/sites/trunk/api.wordpress.org/public_html/core/browse-happy.

Attachments (2)

2587.patch (18.7 KB) - added by SergeyBiryukov 8 years ago.
2587.2.patch (19.1 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
8 years ago

  • Keywords has-patch commit added

In 2587.patch

  • Bump the Internet Explorer version considered secure from 8 to 11.
  • Convert the custom tests.php file to PHPUnit tests, which appears to be the preferred way in newer projects like the Plugin Directory plugin.
  • Add a test for insecure browsers.

Note that there are currently 5 known failures, same as in the current tests.php file, that should be addressed in another ticket:

There were 5 failures:

1) Tests_Browse_Happy::test_browsehappy_parse_user_agent with data set #34 ('Mozilla/5.0 (iPad; U; CPU iPh....21.10', 'iPad Safari 4.0.4')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'iPad Safari 4.0.4'
+'iPad iPad 4.0.4'

S:\home\wordpress.dev\meta\sites\trunk\api.wordpress.org\public_html\core\browse-happy\1.0\tests\phpunit\tests\browse-happy.php:21

2) Tests_Browse_Happy::test_browsehappy_parse_user_agent with data set #35 ('Mozilla/5.0 (iPad; U; CPU OS ....21.10', 'iPad Safari 4.0.4')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'iPad Safari 4.0.4'
+'iPad iPad 4.0.4'

S:\home\wordpress.dev\meta\sites\trunk\api.wordpress.org\public_html\core\browse-happy\1.0\tests\phpunit\tests\browse-happy.php:21

3) Tests_Browse_Happy::test_browsehappy_parse_user_agent with data set #36 ('Mozilla/5.0 (iPhone; U; CPU i...3.18.5', 'iPhone Safari 5.0.2')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'iPhone Safari 5.0.2'
+'iPhone iPhone 5.0.2'

S:\home\wordpress.dev\meta\sites\trunk\api.wordpress.org\public_html\core\browse-happy\1.0\tests\phpunit\tests\browse-happy.php:21

4) Tests_Browse_Happy::test_browsehappy_parse_user_agent with data set #37 ('Mozilla/5.0 (iPhone; U; CPU l.../419.3', 'iPhone Safari 3.0')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'iPhone Safari 3.0'
+'iPhone iPhone 3.0'

S:\home\wordpress.dev\meta\sites\trunk\api.wordpress.org\public_html\core\browse-happy\1.0\tests\phpunit\tests\browse-happy.php:21

5) Tests_Browse_Happy::test_browsehappy_parse_user_agent with data set #46 ('Mozilla/5.0 (Linux; U; Androi...534.13', 'Android Safari 4.0')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Android Safari 4.0'
+'Linux Safari 4.0'

S:\home\wordpress.dev\meta\sites\trunk\api.wordpress.org\public_html\core\browse-happy\1.0\tests\phpunit\tests\browse-happy.php:21

FAILURES!
Tests: 94, Assertions: 58, Failures: 5.

@SergeyBiryukov
8 years ago

#2 @Otto42
8 years ago

  • Owner set to Otto42
  • Status changed from new to accepted

#3 follow-up: @tomdxw
7 years ago

  • Priority changed from normal to high

A user of IE9 or IE10, right now, cannot use the visual editor at all. But they get no message on their dashboard telling them that their browser is unsupported/outdated.

I'm going to bump the priority up if nobody minds as these users will have no idea why WordPress has stopped working for them.

What's needed to move this ticket along? Is there anything I can do to help?

#4 in reply to: ↑ 3 ; follow-up: @SergeyBiryukov
7 years ago

Replying to tomdxw:

What's needed to move this ticket along?

To find someone to review 2587.patch :)

#5 in reply to: ↑ 4 ; follow-up: @tomdxw
7 years ago

I had a look at the patch, and I noticed one issue.

IE9 is marked as insecure, but it's not marked as upgrade:

% php -r '$_SERVER["HTTP_USER_AGENT"]="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";require("test.php");'                                                                                                  
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)<br/><br/>platform = Windows<br/>name = Internet Explorer<br/>version = 9.0<br/>update_url = http://www.microsoft.com/windows/internet-explorer/<br/>img_src = http://s.wordpress.org/images/browsers/ie.png<br/>img_src_ssl = https://wordpress.org/images/browsers/ie.png<br/>current_version = 9<br/>upgrade = 0<br/>insecure = 1<br/>

But in WordPress, if upgrade is set to 0, then it won't produce any warning, even if insecure is set to 1 (wp-admin/includes/dashboard.php line 29):

        $response = wp_check_browser_version();

        if ( $response && $response['upgrade'] ) {
                add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
                if ( $response['insecure'] )
                        wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
                else
                        wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
        }

We just need to change 9 to 11 here, and it will produce the correct output:

function get_browser_current_versions() {
        return array(
                'Chrome'            => '18', // Lowest version at the moment (mobile)
                'Firefox'           => '16',
                'Opera'             => '12.11',
                'Safari'            => '5',
                'Internet Explorer' => '9', // Left at 9 until Windows 7 adopts 10
        );
}

#6 in reply to: ↑ 5 @SergeyBiryukov
7 years ago

Replying to tomdxw:

We just need to change 9 to 11 here, and it will produce the correct output

Good catch! Updated the patch: 2587.2.patch.

This ticket was mentioned in Slack in #meta by sergey. View the logs.


7 years ago

#8 @coffee2code
7 years ago

In 5948:

Browse Happy API: Convert crude unit tests to PHPUnit.

Includes 5 (previously, and still) failing tests.

Props SergeyBiryukov.
See #2587.

#9 @coffee2code
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 5949:

Browse Happy API: Mark versions of Internet Explorer earlier than 11 as insecure.

  • Adds IE 10 & 11 user-agent strings to test data
  • Adds unit test for insecure browsers (currently just testing for IE)

Props SergeyBiryukov.
Fixes #2587.
Fixes #core40165.

Note: See TracTickets for help on using tickets.