#46132 closed defect (bug) (fixed)
Opera changed its render engine to Chrome, $is_opera not working
Reported by: | brasofilo | Owned by: | peterwilsoncc |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
Nowadays, Opera is being detected as "chrome" and $is_opera
returns false.
String detection should include 'OPR'
in
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/vars.php#L86
Attachments (1)
Change History (10)
#1
@
6 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 5.0.2 to 2.2
#2
@
6 years ago
Thanks for taking a look, @desrosj
I discovered this when I needed a specific CSS rule for Opera (using the body_class
filter). And that's because Chrome has an ongoing bug not present in Opera: we can't drag bookmarklets into the bookmarks bar since Chrome 69.
I don't think it'd be a good idea to convert $is_opera
to $is_chrome
, this kind of mishap among browsers is bound to happen even if everybody changes their render-engine to Chromium :)
I'm attaching the needed patch, hope the format is correct.
Checking for Opera has to be done before Chrome's so as not to give a false positive.
This ticket was mentioned in PR #4721 on WordPress/wordpress-develop by @costdev.
16 months ago
#3
- Keywords has-patch added; needs-patch removed
#4
@
16 months ago
- Milestone changed from Future Release to 6.3
WordPress Beta Tester uses these globals and received a support ticket about this issue.
Given that comment 2 details one difference that existed between Chrome and Opera, the safest option seems to be adding an extra condition and moving the Opera branch above the Chrome branch.
For sure, we should explore the purpose and differences of the two and act accordingly. As this ticket is 4 years old, we should try to make sure there's accurate detection.
PR 4721 refreshes the patch to use str_contains()
.
Milestoning for 6.3 as the fix, if accepted, is a straightforward one.
#5
@
16 months ago
Thanks @costdev for the PR.
I have tested the changes it working fine in my test. Ping @audrasjb for final review.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
15 months ago
#8
@
15 months ago
- Owner set to peterwilsoncc
- Resolution set to fixed
- Status changed from new to closed
In 56224:
Thanks for the ticket, @brasofilo!
I did some digging, and this Opera check appears to originally have come from b2 (fun!).
Since Opera now uses Chromium, I'd be curious if
$is_opera
related conditionals throughout core can be removed in favor of$is_chrome
. Differences in the browser's behaviors should be looked into, though.For reference, here is the official documentation for the Opera's user agent.
@brasofilo are you interested in creating a patch for this?