MDL-35469 fix Gecko based browser checks
The problem is that latest firefox versions stopped using dates because they lost the meaning over the time.
This commit is contained in:
+36
-9
@@ -8197,18 +8197,45 @@ function check_php_version($version='5.2.4') {
|
||||
|
||||
|
||||
case 'Gecko': /// Gecko based browsers
|
||||
if (empty($version) and substr_count($agent, 'Camino')) {
|
||||
// MacOS X Camino support
|
||||
$version = 20041110;
|
||||
// Do not look for dates any more, we expect real Firefox version here.
|
||||
if (empty($version)) {
|
||||
$version = 1;
|
||||
} else if ($version > 20000000) {
|
||||
// This is just a guess, it is not supposed to be 100% accurate!
|
||||
if (preg_match('/^201/', $version)) {
|
||||
$version = 3.6;
|
||||
} else if (preg_match('/^200[7-9]/', $version)) {
|
||||
$version = 3;
|
||||
} else if (preg_match('/^2006/', $version)) {
|
||||
$version = 2;
|
||||
} else {
|
||||
$version = 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
// the proper string - Gecko/CCYYMMDD Vendor/Version
|
||||
// Faster version and work-a-round No IDN problem.
|
||||
if (preg_match("/Gecko\/([0-9]+)/i", $agent, $match)) {
|
||||
if ($match[1] > $version) {
|
||||
return true;
|
||||
if (preg_match("/(Iceweasel|Firefox)\/([0-9\.]+)/i", $agent, $match)) {
|
||||
// Use real Firefox version if specified in user agent string.
|
||||
if (version_compare($match[2], $version) >= 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (preg_match("/Gecko\/([0-9\.]+)/i", $agent, $match)) {
|
||||
// Gecko might contain date or Firefox revision, let's just guess the Firefox version from the date.
|
||||
$browserver = $match[1];
|
||||
if ($browserver > 20000000) {
|
||||
// This is just a guess, it is not supposed to be 100% accurate!
|
||||
if (preg_match('/^201/', $browserver)) {
|
||||
$browserver = 3.6;
|
||||
} else if (preg_match('/^200[7-9]/', $browserver)) {
|
||||
$browserver = 3;
|
||||
} else if (preg_match('/^2006/', $version)) {
|
||||
$browserver = 2;
|
||||
} else {
|
||||
$browserver = 1.5;
|
||||
}
|
||||
}
|
||||
if (version_compare($browserver, $version) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user