User tests: Successful: Unsuccessful:
Change the regular expression to detect the correct Firefox version.
Paste the following code snippet into the index.php of the protostar template and open the page in Firefox:
jimport('joomla.environment.browser');
$navigator = JBrowser::getInstance();
var_dump($navigator->getAgentString(), $navigator->getVersion());
The result should show the correct Firefox version e.g.
array (size=2)
'UserAgent:' => string 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0' (length=78)
'Version:' => string '54.0' (length=4)
The version number is "always" 5.0.
array (size=2)
'UserAgent:' => string 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0' (length=78)
'Version:' => string '5.0' (length=3)
Edit: maybe the agent variable should be changed from "mozilla" to "firefox", too? Can we do this for 3.8 or not until 4.x?
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
verified successfully with linux, result is
string(68) "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" string(3) "5.0"
@gorgonz i have altered your Test at Issue Tracker.
Status | Pending | ⇒ | Ready to Commit |
RTC after two successful tests.
Milestone |
Added: |
Are there any user agents with Mozzila in that don't have FF in
@matrikular any feedback on George's question?
@mbabker As mentioned in the description / comments both here and in your PR, "all" User Agents have got Mozilla in it. For that, our browser class would currently identify every browser as "Mozilla/5.0" (mozilla) if no other (more strict) rule applies before, of course.
If the browser is a clone / derivative of Firefox, you could find something like the following in the User Agent string: "Mozilla/5.0 (Windows NT 5.2; Win64; x64; rv:39.0) Gecko/20100101 Firefox/39.0 Waterfox/39.0".
In this example, adding a regular expression for Firefox alone would match and return "firefox", even though it is Waterfox or another clone / derivative (e.g Pale Moon).
In short; Yes, there are User Agents with Mozilla in that don't have FF in. Sadly, if we want to get it right, it seems that this is not easily covered with adding yet another regular expression / rule. Well, at least not for the long run.
That said, I would like to propose the following changes:
Those changes sound reasonable to me.
Me too :)
To merge this PR, let's do 3 things:
elseif (preg_match('|Mozilla/([0-9.]+)|', $this->agent, $version))
condition as the last condition in the browser checkJBrowserTest
remove lines 154 thru 157 as with this PR the Firefox UAs I added for the tests there should now correctly be parsedWe can work on further improving from here but we really REALLY should (finally) fix Firefox detection.
Labels |
Added:
Conflicting Files
|
Labels |
Added:
?
|
Category | Libraries | ⇒ | Libraries Unit Tests |
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-31 22:31:29 |
Closed_By | ⇒ | mbabker | |
Labels |
Removed:
Conflicting Files
|
I have tested this item✅ successfully on 886dd25
Without PR:
With PR:
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17051.