[wp-trac] [WordPress Trac] #55297: The $is_edge global returns false.

WordPress Trac noreply at wordpress.org
Wed Mar 2 17:26:44 UTC 2022


#55297: The $is_edge global returns false.
-------------------------+-------------------------------------------------
 Reporter:  costdev      |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  6.0
Component:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:  good-first-bug needs-patch needs-
  Focuses:               |  testing has-testing-info
-------------------------+-------------------------------------------------
 `$is_edge` is `true` when "Edge" is detected.

 However, user agents for Edge have changed such that "Edg" is the only
 consistent substring across devices. As a result, `$is_edge` returns
 `false`.

 Changing the substring to "Edg" in `src/wp-includes/vars.php:68` seems to
 fix this.

 Steps to reproduce and test the solution:
 1. Add this to `functions.php`:

 {{{#!php
 global $is_edge;
 die( var_export( $is_edge, true ) );
 }}}

 2. Load any page. `false` should be displayed.
 3. Change "Edge" to "Edg" in `src/wp-includes/vars.php:68`.
 4. Reload the page. `true` should now be displayed.

 Reference: [https://docs.microsoft.com/en-us/microsoft-edge/web-platform
 /user-agent-guidance#identifiers-for-microsoft-edge-on-various-platforms
 Microsoft Docs - Identifiers for Microsoft Edge on various platforms]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55297>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list